This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes java command error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "java command error" Watch "java command error" New topic
Author

java command error

Jude Fawly
Ranch Hand

Joined: Dec 01, 2004
Posts: 33
Hi there,

I wrote a program and it compiles correctly from command line with (javac), but when I use (java) to run the application, I get the following error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: art (Unsupported major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)


----
Can somebody help?
Thanks.


Teach me to die that so I may<br />Rise glorious at the awful day
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

You're compiling with the javac from JDK 6, but running with an older version of Java. This often happens because Java installers will sometimes, but not always, put a copy of java.exe into c:\WINDOWS\ (or some equivalent) to support the Java Plugin. Either find that extra java.exe and replace it, or replace it with java.exe from JDK 6, or change your PATH environment variable to put the Java 6 bin directory first, or use an explicit path to invoke java.exe from that directory... etc.


[Jess in Action][AskingGoodQuestions]
Jude Fawly
Ranch Hand

Joined: Dec 01, 2004
Posts: 33
Hi Ernest,

I went with one of the options you provided which is to change the path in the environment variables to take java.exe from the java bin directory as the first option. It is working now.

Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java command error
 
Similar Threads
package javax.servlet.http does not exist
Sealing Violation
Weblogic platform8.1 SP4 installation error
Exception in thread "main" java.lang.NoClassDefFoundError
Why am I not able to this code in eclipse?