Re: java 101 question - how to run a java program
- From: Dan Hicks <danhicks@xxxxxxxx>
- Date: Sun, 16 Jul 2006 04:25:35 GMT
You skipped a very important step. Go back and rename the source file from .class to .java, then STRQSH, cd /home/srichter/java, and do "javac java01.java".
After you've corrected your source error (need to call the class "java01" if it's in file "java01.java"), you will end up with a ..class file in the same directory as the .java file.
Then just do "java java01" (or whatever you named it). No need to do CRTJVAPGM -- that's done implicitly when you execute the .class file the first time.
Steve Richter wrote:
working entirely from the as400 green screen ....
I create a stream file with some java source code:
class Example {
public static void main( String args[]) {
System.out.println( "This is a simple Java program." ) ;
}
}
file name is /home/srichter/java/java01.class
I compile the program:
CD DIR('/home/srichter/java')
CRTJVAPGM CLSF(java01.class)
========> first question: the program compiles successfully. Where
does the system place it? After the compile the /home/srichter/java
directory does not contain any new object. just the one source file.
Now I want to run this program ( from the green screen )
CD DIR('/home/srichter/java')
RUNJVA CLASS(java01.class) CLASSPATH(Example)
I try all different variations on the theme of running the java01
class file and the Example class it contains with no success. A lot
of "NoClassDefFoundError" errors.
How do I run my simple java program?
thanks,
Steve Richter
--
Dan Hicks
Change is inevitable -- except from a vending machine.
.
- Prev by Date: Re: Disable Line feed in printf
- Next by Date: Re: java 101 question - how to run a java program
- Previous by thread: Re: java 101 question - how to run a java program
- Next by thread: Re: java 101 question - how to run a java program
- Index(es):
Relevant Pages
|
Loading