aspose file tools*
The moose likes Beginning Java and the fly likes Unsupported major.minor version 49.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Unsupported major.minor version 49.0" Watch "Unsupported major.minor version 49.0" New topic
Author

Unsupported major.minor version 49.0

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i was trying to run this code from B Eckel's Thinking in Patterns:

when i run it from textpad i get:
C:\simplifying
java.lang.NoClassDefFoundError: simplifying/MessengerDemo
Exception in thread "main"

and when i try from command line, then i get this:
C:\>java -cp "." simplifying.MessengerDemo
Exception in thread "main" java.lang.UnsupportedClassVersionError: simplifying/M
essengerDemo (Unsupported major.minor version 49.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)

What's going on?

thanks in advance


java amateur
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

As for the TextPad error -- don't know. TextPad setup must not be correct?

But as to the other error: you're got more than one JDK installed on your machine; apparently the one you get on your PATH when you just type "java" is older than the one TextPad used to compile your classes; newer JDKs can compile classes that older ones can't run.

Adjust your PATH environment variable so that the newest JDK you have is the first one on the path -- or consider uninstalling the older ones altogether.


[Jess in Action][AskingGoodQuestions]
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i had indeed two javas, deleted older one, checked path - just last one present... and same error persists
edited:
i deleted the Classes and i've in my CLASSPATH: C:\jarsParaEclipse\junit-3.8.1.jar and in my PATH: C:\j2sdk1.4.2_06
i made:
C:\>javac -classpath . simplifying/*.java
simplifying/MessengerDemo.java:5: package junit.framework does not exist
import junit.framework.*;
^
simplifying/MessengerDemo.java:10: cannot resolve symbol
symbol : class TestCase
location: class simplifying.MessengerDemo
public class MessengerDemo extends TestCase {
^
simplifying/Point.java:3: package junit.framework does not exist
import junit.framework.*;
^
simplifying/Space.java:5: package junit.framework does not exist
import junit.framework.*;
^
simplifying/Vector.java:3: package junit.framework does not exist
import junit.framework.*;
^
simplifying/MessengerDemo.java:22: cannot resolve symbol
symbol : method assertEquals (java.lang.String,java.lang.String)
location: class simplifying.MessengerDemo
assertEquals(result,
^
simplifying/MessengerDemo.java:30: package junit.textui does not exist
junit.textui.TestRunner.run(MessengerDemo.class);
^
7 errors



edited... again
i worked it out:
C:\>javac -classpath .;C:\jarsParaEclipse\junit-3.8.1.jar simplifying/*.java
C:\>java -cp .;C:\jarsparaeclipse\junit-3.8.1.jar simplifying.MessengerDemo
.p1: x: 1 y: 2 z: 3 p2: x: 2 y: 3 z: 4

Time: 0,016

OK (1 test)


thanks for helping!
[ March 13, 2005: Message edited by: miguel lisboa ]
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
You didn't delete java.exe and javaw.exe in your windows or windows/system32 and/or windows/system directories...


42
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
You didn't delete java.exe and javaw.exe in your windows or windows/system32 and/or windows/system directories...


not sure what you mean: i did use add/remove from control panel to remove older java
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
that doesn't always remove everything. Sometimes things get left behind, the superfluous java runtimes in the windows directory are notorious.
Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Type:

java -version

at the command line. Then if it's the wrong version, use a which.exe utility to tell you which executable is getting picked up first (via the path statement). One version is available here:

http://www.paulsadowski.com/WSH/cmdprogs.htm

-Jeff-


Books: Agile Java, Modern C++ Programming with TDD, Essential Java Style, Agile in a Flash. Contributor, Clean Code.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
C:\>java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

so i guess i'm ok

thanks to both!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unsupported major.minor version 49.0