• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error while migrating from jdk1.3 to jdk1.5

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you get when you run "java -version" ?

Henry
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Preethinj Math
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Preethinj Math
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic