This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Help! Error trying to run after JDK install Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help! Error trying to run after JDK install" Watch "Help! Error trying to run after JDK install" New topic
Author

Help! Error trying to run after JDK install

Brian Wieb
Greenhorn

Joined: Apr 14, 2005
Posts: 4
Hello,
Can anyone help with an error I'm getting trying to run a simple app? I have just installed jdk1.5.0_03

The error is "Exception in java "main" java.lang.UnsupportedClassVersionError: SimpleGui1 (Unsupported major.minor version 49.0)

The code is:
import javax.swing.*;

public class SimpleGui1 {
public static void main (String[] args) {
JFrame frame = new JFrame();
JButton button = new JButton("click me");

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().add(button);

frame.setSize(300,300);

frame.setVisible(true);
}
}

Thanks in advance !
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi Brian,

Welcome to JavaRanch!

You've got more than one version of Java installed on your machine, which is perfectly OK -- but you have to keep them straight. You've compiled your classes with JDK 1.5, but are trying to run it with an older version.

You can either find the offending copy of Java (some older JDKs liked to put a copy of java.exe into C:\WINDOWS\ or some other such silly place) and delete it, or you can modify your PATH environment variable so that the JDK 1.5 installation location comes before the location of this older Java version. Whichever is easier for you.


[Jess in Action][AskingGoodQuestions]
Brian Wieb
Greenhorn

Joined: Apr 14, 2005
Posts: 4
Thank you ! Thank you !
Wow, I'm an old RPG programmer trying to learn JAVA for a new job. It's quite a culture shock for me with all this "newfangled" stuff.
I uninstalled the older version and it works fine. I was really stumped so your suggestion got me going again..for now...I may have to use this forum again. Thanks for the help !
Brian.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help! Error trying to run after JDK install