[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

(Unsupported major.minor version 49.0)

Posted on 2006-06-05
8
Medium Priority
?
702 Views
Last Modified: 2012-06-21
I'm very very new to Java and have created a quick application using NetBeans 5.0 under Windows XP

The only JDK I've got installed is: J2SE Version 5.0 Update 6.

When I check for the J2SE runtime Environment, it shows that I have Version 5, Updates 1 through 7 installed.

I've built my application and the relevant files appear to exist, however dropping to a command line and running :

//////////////
java -jar "D:\java_projects\ContactEditor\dist\ContactEditor.jar"
/////////////

Gets the following error:

//////////////
Exception in thread "main" java.lang.UnsupportedClassVersionError: my/contactedi
tor/ContactEditorUI (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)
//////////////

When I check to see what version of Java I have available with a "java -version" I get the following:

//////////////
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
//////////////

I'm confused as to how to "execute" the .jar file using a 1.5 JRE....

Any ideas on where I'm going wrong? The project works great within the IDE...

0
Comment
Question by:misdevelopment
8 Comments
 
LVL 30

Accepted Solution

by:
Mayank S earned 2000 total points
ID: 16833773
Set JAVA_HOME environment variable to refer to your JDK 1.5.06 installation root JDK directory.

Ensure that %JAVA_HOME%\bin is there in the path followed by everything else separated by semi-colon ;
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16833778
(Assuming that is the version to which your Netbeans project is referring).
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16833790
If you don't know how to change environment variables, goto My Computer, right-click -> Properties -> Advanced -> Environment variables (add a new System environment variable for JAVA_HOME if it is not present).

Also verify in the registry -> HKEY_LOCAL_MACHINE -> SOFTWARE -> JavaSoft -> Java Runtime Environment -> CurrentVersion as to what the current version is.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:hoomanv
ID: 16833996
as a highlight
49 means that it was compiled with a 1.5, and 48 means 1.4. Depending on how it was compiled it may not be usable on 1.4. The 1.5 defaults to writing class files that are only compatible with 1.5
here you can learn more abour major/minor versions
http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html
0
 

Author Comment

by:misdevelopment
ID: 16834009
All environment variables have been added and checked. The current version within the Registry shows as 1.5

Still getting the same error messages...... Java -version is still showing 1.3.

Tried the obvious reboot after the changes to no avail....

Quite bizarre... :-)

JC
0
 

Author Comment

by:misdevelopment
ID: 16834401
Having investigated further than the end of my nose and decided to search for how many versions of java.exe I'd got on my system, it turns out my Oracle client has a java.exe and Oracle appears first on my PATH statement!

Running the java.exe from within the directory that I wanted to be in worked perfectly....So, just down to paths / variables !!!

Thanks all!
0
 
LVL 15

Expert Comment

by:Javatm
ID: 16834412
The best solution is to uninstall every java vm's you might have then install the latest version which is 1.5 this will not work unless your not the admin.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16839650
>> it turns out my Oracle client has a java.exe and Oracle appears first on my PATH statement

Yes, it will - which is why I told you to define JAVA_HOME and put %JAVA_HOME%\bin in the PATH before everything else so that this version of Java is the default one.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question