Compile HelloWorld.java on X PB?

barryhf

Registered

I'm trying to do a very simple thing, compile HelloWorld.java on Mac OS X Public Beta.

java and javac are apparently in the path, the program is in the current directory. java compiles it into a .class file. But when I try to run the app "java HelloWorld.class", I get the ClassNotFound exception at run time.

This is the same HW app that I've compiled under OS9, Linux and NT. I've tried "setenv CLASSPATH = ." I'm running from the directory that the .class file is in.

Clues?

OS X PB out of the box.
I didn't download the dev tools.

 
Originally posted by barryhf
But when I try to run the app "java HelloWorld.class", I get the ClassNotFound exception at run time.
This just a common error.
you have to call "java HelloWorld", without the ending .class.
The call "java HelloWorld.class" would mean you are calling a class named class inside the pachkage HelloWorld.

So always call your classes without the ending.
 
Back
Top