Win a copy of Securing DevOps this week in the Security forum!

ray wongray

Greenhorn
+ Follow
since Feb 04, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ray wongray

Markas Korotkovas wrote:did you remember to compile all your Java classes? Use javac?



Could you please tell me how to do it??? I use JCreator and I thought it already compiled all the java class when I clicked "run project"
7 years ago

Campbell Ritchie wrote:Confirm that the files you want are in the directory you think they are in. Tell us what you found.
Get your command prompt to show you what classpath it is using. Not quite sure what the instruction for that is, however. Something like ECHO %CLASSPATH%, or %CLASSPATH%, but I can't remember the details.



I saved the java code to C:\bin
and the result of ECHO %CLASSPATH% is
.;C:\bin;C:\Program Files\Java\jdk1.6.0_23\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_23\lib\tools.jar
7 years ago

Wouter Oet wrote:Don't use the CLASSPATH environment variable. It will only cause more problems then it will solve. Just use the -cp argument of java.

The error that you're getting means that the class that you're trying to use can't be found. Is it on the classpath?



thanks. I deleted the CLASSPATH variable but it still not working. what should I do??
7 years ago
hi guy,
I am using JCreator to compile and code java, but when I clicked "run project", it showed that
--------------------Configuration: <Default>--------------------
java.lang.NoClassDefFoundError: HelloPrinter
Caused by: java.lang.ClassNotFoundException: HelloPrinter
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: HelloPrinter. Program will exit.
Exception in thread "main"
Process completed.

I google it before and I changed my environment variables to
CLASSPATH .;
JAVA_HOME C:\Program Files\Java\jdk1.6.0_23
PATH .;%SystemRoot%\system32;%JAVA_HOME%\bin;
but it still not working.
Can anyone please help to solve this??
Thanks.
7 years ago