Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java installation problem

802591Oct 2 2010 — edited Oct 4 2010
Hi,
I installed recently java with the jdk1.6.0_21 kit. I am now able to compile but unable to run a java program.
After creating a HelloWorld.java file and compiling, I get a class file alright. But when I try to run it, I get the following error message :
C:\Eclipse35>java apples
Error: could not open `C:\Program\Java\jdk1.6.0_21\lib\i386\jvm.cfg'

When I switch the directory and ask for the version, I get the following output :

C:\Program\Java\jdk1.6.0_21\bin>java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)

But when I change the command slightly, I get the following error message :
C:\Program\Java\jdk1.6.0_21\bin>java version
Exception in thread "main" java.lang.NoClassDefFoundError: version
Caused by: java.lang.ClassNotFoundException: version
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: version. Program will exit.

I hope that all this helps the experts in troubleshooting my problem. I would like to know what I should do to solve this problem and get started with running java programs.

I included the following in the path variable in the environmental system variables :
C:\Program\Java\jdk1.6.0_21\bin

Thanking you,
Ravi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 1 2010
Added on Oct 2 2010
3 comments
330 views