File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes UnsupportedClassVersionError (unsupported major.minor version 50.0) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "UnsupportedClassVersionError (unsupported major.minor version 50.0)" Watch "UnsupportedClassVersionError (unsupported major.minor version 50.0)" New topic
Author

UnsupportedClassVersionError (unsupported major.minor version 50.0)

Krep Lock
Ranch Hand

Joined: Sep 19, 2006
Posts: 43
I've tried to install the JDK on my laptop and it's devolved into a horriffic timesink. I cannot get the simplest program to run:



F:\Java\StartingOut\chapter2>javac test.java
F:\Java\StartingOut\chapter2>java test
Exception in thread "main" java.lang.UnsupportedClassVersionError: test (Unsuppo
rted major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)

F:\Java\StartingOut\chapter2>SET CLASSPATH=

F:\Java\StartingOut\chapter2>javac test.java

F:\Java\StartingOut\chapter2>java test
Exception in thread "main" java.lang.UnsupportedClassVersionError: test (Unsuppo
rted major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)

F:\Java\StartingOut\chapter2>javac -cp . test.java

F:\Java\StartingOut\chapter2>java -cp . test
Exception in thread "main" java.lang.UnsupportedClassVersionError: test (Unsuppo
rted major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)

F:\Java\StartingOut\chapter2>


...so it's not likely to be CLASSPATH. I've tried installing that latest JDK/JRE, but nothing resolves this problem.

It's been a long time since I've done anything with Java; I've been working with other languages. Am I missing something simple here? Or am I going to have to resort to brain surgery on my laptop to fix some obscure setting or registry before this will work?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

You've got an extra copy of java.exe someplace on your path, from an older version of Java. You're therefore compiling with a new javac.exe which is generating class files that the old java.exe won't read.

It's probably in C:\WINDOWS or thereabouts. You can find it and delete it, or you can change your PATH to put your JDK bin directory first.


[Jess in Action][AskingGoodQuestions]
Krep Lock
Ranch Hand

Joined: Sep 19, 2006
Posts: 43
Fixed!

Thanks very much. I'm glad I posted here instead of throwing my hands in the air and quitting.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: UnsupportedClassVersionError (unsupported major.minor version 50.0)