You can run an IBM® i Java™ program
remotely in the i Java Transform
and Run view
or in the Launch Configurations window.
Before you begin
Any Java program that you run must be an application (a
class that contains a main method).
Before you can run an IBM i Java program, you must export Java class
files to an IBM i integrated
file system directory. Java source files are required on an IBM i server
to debug IBM i Java programs.
- In the Launch Configurations window you run a program that you have exported
to an IBM i server
and you also store locally. (Launch configurations are Eclipse mechanisms
for saving and reusing the settings that you use when you run or debug different
types of objects.)
- In the i Java Transform
and Run view
you call the program from the server; the view is independent of the local
workspace.
About this task
In the i Java Transform
and Run view
Procedure
- Open a Java perspective if one is not currently available:
Click .
- Switch to the Transform and Run view:
- Click the down arrow next to the Run icon on
the workbench menu bar.
- Select .
- To populate the Working Folder field, click Browse to
select a directory in the Browse For Folder window.
- Optional: Click Advanced Options to specify
program parameters, properties, and IBM i run
options. In the Select i Options window,
choose the properties you want and click OK. The options
are described in the related references below.
- Click the Run remotely tab.
- In the Class field, enter the name of the
class file.
- Click Run to start the remote invocation.
The Console out field displays output or any errors.
- Use the Console in field to enter information
for the program (if the program asks for input). Data entered in this field
is passed to the remote program when you press Enter.
Results
The Java application runs on the IBM i server. At any time while the program is running, you can click Stop.
Click Clear Console to clear the Console
out field.
In the Launch Configurations window
- Open a Java perspective if one is not currently available:
Click .
- Click the down arrow next to the Run icon on the workbench
menu bar.
- Select Run. The Create, manage, and run configurations
window opens.
- Click Java
Application in i Server.
Click New to create a configuration of the selected
type.
- Optional: Give the configuration a name.
- Under the Main tab, fill in the name of the project
and the name of the Main class in your project. Browse to the Remote
i working folder, enter the name, or select the name from the drop-down list.
This is the IFS folder containing the remote package, or the class itself
if the class does not have a package.
- Optional: Use the other tabs to add parameters, set class path, and so
on.
- Click Run to run the program.
After you define a configuration, it appears as a shortcut in the
down-arrow menu.
What to do next
If the Java class file is on the IFS, you can run it in the
Remote Shell view. In the Remote System Explorer, right-click the IFS Files
subsystem under the connection and select
Launch Shell.
See the related task on working with command shells.