hi
please help me the problem is the program is compling but not runing the pgm ,java,path,output bmbs are the image of the programme,java in my system, path is the path settings and output is the output when running

thanks for reply

09-20-2010, 07:33 AM

DarrylBurke

I'm not about to download a 46 KB zip to try to find out what's wrong with your code. Isolate the problem and post a SSCCE.

That's an easy one: your class Test is nowhere to be found in your classpath list (as the jvm already told you so).

kind regards,

Jos

09-21-2010, 08:26 AM

javastuden

thanks for the reply
that i know the error oocured
Exception in thread "main" java.lang.NoClassDefFoundError: HelloRunnable
Caused by: java.lang.ClassNotFoundException: HelloRunnable
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: HelloRunnable. Program will exit.

thanks for the reply
that i know the error oocured
Exception in thread "main" java.lang.NoClassDefFoundError: HelloRunnable
Caused by: java.lang.ClassNotFoundException: HelloRunnable
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: HelloRunnable. Program will exit.

Are you trying to run something else now? Don't do that, stick with your previous example: as I wrote: nowhere can that class be found by the jvm; set the classpath variable:

Code:

java -cp . Test

kind regards,

Jos

09-21-2010, 08:41 AM

javastuden

hi
in my system there is jdk1.5.0_03,jdk1.6.0,jdk1.6.0_12,jre1.5.0_03,jre1. 6.0,jre1.6.0_04,jre6
are there in C:\Program Files\Java in path also
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys tem32\Wbem;;C:\Program Files\J
ava\jdk1.6.0_12\bin;C:\Program Files\MySQL\MySQL Server 5.2\bin;C:\Program Files
\K-Lite Codec Pack\QuickTime\QTSystem\;D:\apache-ant-1.6.0\bin;D:\axis2-1.5.1\bi
n;

what is the problem i also do
>java -cp C:\Program Files\Java\jdk1.6.0_12\bin; HelloRunnable
then the same there is the class file is created but its not running

09-21-2010, 09:14 AM

JosAH

Quote:

Originally Posted by javastuden

hi
in my system there is jdk1.5.0_03,jdk1.6.0,jdk1.6.0_12,jre1.5.0_03,jre1. 6.0,jre1.6.0_04,jre6
are there in C:\Program Files\Java in path also
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys tem32\Wbem;;C:\Program Files\J
ava\jdk1.6.0_12\bin;C:\Program Files\MySQL\MySQL Server 5.2\bin;C:\Program Files
\K-Lite Codec Pack\QuickTime\QTSystem\;D:\apache-ant-1.6.0\bin;D:\axis2-1.5.1\bi
n;

what is the problem i also do
>java -cp C:\Program Files\Java\jdk1.6.0_12\bin; HelloRunnable
then the same there is the class file is created but its not running

Your Java system is a mess: you don't need all those different versions and it is totally not done to stick your compiled Java code in the directory where your tools are stored. Throw everything away, read the tutorials and start over. btw, your path variable and classpath variable are two different things.