Results 1 to 11 of 11
  1. #1
    gskn4u is offline Member
    Join Date
    Oct 2009
    Posts
    6
    Rep Power
    0

    Default java.lang.UnsupportedClassVersionError

    Hi All,
    i have recently installed jdk-6-windows-i586.exe. I also set Path and classpath (environmental variables). I could able to compile the hello.java file but when i am trying to run using the command

    java hello

    i am getting the below error

    Exception in thread "main" java.lang.UnsupportedClassVersionError: hello (Unsupported major.minor version 50.0)
    at java.lang.classloader.defineclass0(Native Methos)
    at java.lang.classloader.defineclass(Unknown Source)
    at java.security.secureclassloader.defineclass(unknow n source)
    at java.new.URLClassLoader.defineclass(Unknown source)
    at .....



    i have run the command

    C:\>java -version
    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)

    C:\>javac -version
    javac 1.6.0

    I have checked the forum i found the same. Compiled the source code with higher version and trying to run the .class file with lower version. Then i tried by uninstalling jdk and re-install it. But i am facing the same problem.

    My question is how to know/find which path command prompt is point for java.exe. So that i could uninstall and then re-install it again.

    or if there are any other solution please help me.

    Thanks,

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    check if there are other versions of Java on your system path. If so, get rid of the old versions in the path.

  3. #3
    gskn4u is offline Member
    Join Date
    Oct 2009
    Posts
    6
    Rep Power
    0

    Default

    Fubarable,

    Yesterday i tried to find out but couldn't. can you help me by telling how to find other versions of java. i checked "Add remove programs" and removed everything with java and then re-installed jdk but it didn't help. also checked plugins but no use. can you please help me.
    Thanks,

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I may be wrong here, but the issue may not be so much which versions of Java are on your machine, but what the System Path looks at first. Are you using Windows? Do you know how to inspect and edit the System Path? If so, have a look and see if it looks for Java version 4 before it looks for 6. If so, remove version 4 from the Path.

  5. #5
    gskn4u is offline Member
    Join Date
    Oct 2009
    Posts
    6
    Rep Power
    0

    Default

    Hi

    i found something in path
    Java Code:
    G:\oracle\product\10.1.0\Db_2\jre\1.4.2\bin
    I did not put this in PATH variable and i think it got in there automatically when i installed oracle. But if i remove/delete this, will it not affect the oracle setup.

    and yes i am using Windows.
    Last edited by gskn4u; 10-03-2009 at 09:32 AM.

  6. #6
    gskn4u is offline Member
    Join Date
    Oct 2009
    Posts
    6
    Rep Power
    0

    Default

    Java Code:
    G:\oracle\product\10.1.0\Db_2\bin;G:\oracle\product\10.1.0\Db_2\jre\1.4.2\bin\client;G:\oracle\product\10.1.0\Db_2\jre\1.4.2\bin;G:\app\Babloo\product\11.1.0\db_1\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;

  7. #7
    gskn4u is offline Member
    Join Date
    Oct 2009
    Posts
    6
    Rep Power
    0

    Default

    can anyone help me.

  8. #8
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Have you tried removing the path to the oracle jre to see what happens to both your program and oracle? I mean you can't ruin anything by just doing a little experimenting on your own here, can you?

  9. #9
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by gskn4u View Post
    can anyone help me.
    You've already been told all you need really. You can't compile a program with 1.6 (for 1.6) and run it with 1.4.
    Your javac version on your path is 1.6 and your java version on your path is 1.4.
    If you want to keep both on the path like that then you'll need to explicitly state which version you want to use for every command you run.

  10. #10
    gskn4u is offline Member
    Join Date
    Oct 2009
    Posts
    6
    Rep Power
    0

    Default

    Thank you Fubarable and r035198x. Experimenting worked for me. i did not remove the oracle path but i have changed the order. i have put jdk path first. it did work for me.

    Thank you.

  11. #11
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 5
    Last Post: 03-17-2011, 03:26 PM
  2. Replies: 3
    Last Post: 09-07-2009, 02:28 PM
  3. Replies: 2
    Last Post: 12-02-2008, 12:01 PM
  4. Replies: 2
    Last Post: 09-18-2008, 08:30 AM
  5. java.lang.UnsupportedClassVersionError
    By bbq in forum Advanced Java
    Replies: 1
    Last Post: 07-05-2007, 05:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •