File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Error while migrating from jdk1.3 to jdk1.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Error while migrating from jdk1.3 to jdk1.5" Watch "Error while migrating from jdk1.3 to jdk1.5" New topic
Author

Error while migrating from jdk1.3 to jdk1.5

Preethinj Math
Greenhorn

Joined: Mar 07, 2006
Posts: 10
Hi,
I am migrating from sdk1.3 to jdk1.5, and when I comile a program
it comiled fine,but when I tried to run that program,I got an error message saying that

Exception in thread "main" java.lang.UnsupportedClassVersionError: Hello (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)


I didn't understand what to do next,I changed in classpath,path everywhere from 1.3 to 1.5.
Need advice!

Thanks
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18977
    
  40

What do you get when you run "java -version" ?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
You have attempted to load a class running under a VM that does not support that version of the class file. For example, you have (probably) compiled with -target 1.5 on a 1.5 compiler and are now trying to run it on a 1.3 VM.

The API spec. for that specific exception will likely yield more results.


Tony Morris
Java Q&A (FAQ, Trivia)
Preethinj Math
Greenhorn

Joined: Mar 07, 2006
Posts: 10
hi,
when I ran with the command :java -version helloworld
I got this message as

java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

looking for some help!
thanks,
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18977
    
  40

You may be migrating from Java 1.3 to Java 1.5, but for some reason, your "java" interpreter is from Java 1.4.2. You need to configure your system to use the "java" that came with 1.5, assuming that is what compiler you used.

Henry
Preethinj Math
Greenhorn

Joined: Mar 07, 2006
Posts: 10
Thanks Henry,

now I have another question.
How do I configure my system to use the "java" that came with 1.5,?
I have no idea.

Thank again
Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
You need to make sure that your PATH environment variable points to the location of your 1.5 SDK bin directory. Therefore you need to remove the 1.4 jdk from the path and add the 1.5

i.e on my machine the PATH is

PATH=C:\progra~1\java\JDK15~1.0_0\bin;.....



You might also want to make sure that your CLASSPATH variable doesn't point to any old classes.
Rachil Chandran
Ranch Hand

Joined: Mar 05, 2006
Posts: 67
also if u have both the paths, for the 1.5 and 1.4.2 in ur path variable, the path that is specified first (from left to right ofcourse) would be take.
eg: path=~/1.5/bin;~/1.4.2/bin; would use your 1.5 version every time you execute java command


SCJP2 96%
Preethinj Math
Greenhorn

Joined: Mar 07, 2006
Posts: 10
Finally it worked! thanks a lot

I had jdk1.5 only in the path but before that there was a oracle path with 1.4.2 and may it was going there and picking that one,when I moved the jdk1.5 to in the beginning it worked fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while migrating from jdk1.3 to jdk1.5