This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths 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 Head First Android this week in the Android 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

Help! Error trying to run after JDK install

Brian Wieb

Joined: Apr 14, 2005
Posts: 4
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");





Thanks in advance !
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

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

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 !
I agree. Here's the link:
subject: Help! Error trying to run after JDK install
jQuery in Action, 3rd edition