Sagar Lad
Sagar Lad

Reputation: 41

Run Java Program in Iseries(AS400)

Using Qshell,I have compiled Java Program that is saved in IFS Folder.After Compilation,Class file has been generated.But when i tried to run this class,it is not displaying any output.It simply gives $Prompt without any error.But when i checked the spool files,it is showing this:"Unable to Complete Java Program because of reason 04 and Code 4 means:Unable to find method id required to run java program.."

Ex. Simple Hello World Program :System.out.prinln("Hello World"); Compile:-cd /test(where test=directory where program is saved) javac sample.java Run:-java cp /test sample

Upvotes: 0

Views: 2746

Answers (1)

James Allman
James Allman

Reputation: 41148

The main method signature may not be valid. The code should be placed inside a properly defined main method:

class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

To compile and execute from QSH:

$ javac HelloWorld.java
$ java HelloWorld
Hello World

See Lesson: A Closer Look at the "Hello World!" Application for more information.

Upvotes: 1

Related Questions