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

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(
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(

Can somebody help?

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

Joined: Jul 08, 2003
Posts: 24183

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.

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?