Launching a Java program

Java programs may be launched in either run or debug mode.

To launch a Java program:

  1. In the Package Explorer, select the Java compilation unit or class file you want to launch.
  2. If you want to debug the program first, in the top menu bar select the Run > Debug As > Java Application

    Otherwise, select Run > Run As > Java Application

  3. If you selected a Java program, your program is now launched in the mode you selected, and the launch appears in the Debug view.

    If you selected a Java project, you may be prompted to select the class you wish to launch. Only those classes that define a main method are available to select. If only one class with a main method is found in the project, that class is automatically chosen. The chosen class is launched in the mode you selected.

Launching from other views and editors

You can launch a program without first selecting it in the Packages or Navigator view. For example, if the active editor is open on the program you wish to launch, you can select Run > Debug As > Java Application or Run > Run As > Java Application

Launching with another launch configuration type

You may also launch a program using a launch configuration type other than Java Application.

To do this, select a program or project in the Package Explorer, then select the launch configuration type you wish to use from the menu options under Run > Debug As in the top menu bar.

Related concepts

Java views
Java editor
Debugger

Related tasks

Connecting to a remote VM with the Java Remote Application launcher
Relaunching a program
Running and debugging
Setting execution arguments
Stepping through the execution of a program
 

Related reference

Debug view
Package Explorer


 Copyright IBM Corporation 2000, 2002. All Rights Reserved.