• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java woes, can anyone help?

DML1001

Member
I have JCreator installed on my PC, and i use it to develop Java apps.
Recently, I tried to run my program from the command line.

I copied all the java files for my classes to the root directory, and type:
javac MainScreen.java

it compiles fine, no errors
then, i type:
java MainScreen.java

and I get:
Exception in thread "main" java.lang.NoClassDefFoundError: MainScreen/java

Now, I know that CLASSPATH has to be setup properly, but I believe mine is:
CLASSPATH="C:\Program Files\Java j2sdk1.4.1_01\bin";.

If i copy all the files into the jcreator directory, and compile/run them there, everything works fine, no errors.

Anyone know why the program only runs in one folder, even when CLASSPATH is setup properly?
 
Try "java MainScreen" no .java extension. BTW you can do this in any directory. You do not have to copy everything to the root directory. Just make sure that your classpath includes "." or it is not set at all.
 
Back
Top