• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Help! Error trying to run after JDK install

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Brian Wieb
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic