File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 24199

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.

I agree. Here's the link:
subject: java command error
It's not a secret anymore!