0

I'm trying to write an IM client/server program for my final year project. I've downloaded some source code from sourceforge.net (http://sourceforge.net/projects/undergroundim/) to learn some coding practices from. However, when I try to compile/run same, the above error message appears.

I've have tried to follow the steps outline here (Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0)) for Mac, but without success.

I'm using Eclipse Kepler on Macintosh. One possibility may be that the code is not Mac compatible. I'm unsure about this one, as I thought Java was platform agnostic. I'm pretty new to Java.

Any help is greatly is greatly appreciated.

Thank you very much.

Community
  • 1
  • 1
mickm
  • 281
  • 2
  • 6
  • 20
  • 1
    That error is caused by incompatible Java versions. You're most likely trying to run something compiled by a newer Java version with an older Java version. You should check your Java versions. – webuster Feb 09 '14 at 13:55
  • Which Java implementation are you using? Which version is the JVM you're running? – Mauren Feb 09 '14 at 13:55
  • 1
    "but without success" doesn't tell us what happened, or *exactly* what you tried. There are *lots* of questions about this particular error - you should look through all of them, and if you think this is *genuinely* a different question, explain why. – Jon Skeet Feb 09 '14 at 13:55
  • Oracle's Java Virtual Machine implementation in JDK release 1.0.2 supports class file format versions 45.0 through 45.3 inclusive. JDK releases 1.1.* support class file format versions in the range 45.0 through 45.65535 inclusive. For k ≥ 2, JDK release 1.k supports class file format versions in the range 45.0 through 44+k.0 inclusive. Ie, Java 1.7 supports through version 51. Switch to your java environment directory & search path and type `java -version` and `javac -version`. – Hot Licks Feb 09 '14 at 14:13
  • (Note that an option, rather than upgrading your Java install, is to recompile all of the offending classes, if you have the source and they're not dependent on using features in 1.7.) – Hot Licks Feb 09 '14 at 14:15
  • @Mauren: Thanks for your reply. I checked my java version ('java -version' in Terminal) My Java version is "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode). – mickm Feb 09 '14 at 14:19
  • @user3029329 as mentioned by other comments, you should update your JVM to run an app which was developed using Java 7. – Mauren Feb 09 '14 at 14:20
  • @HotLicks: Thank you for your reply. I installed the latest Java update for Mac, which is is 'Java RE7 U51'. Terminal says my java-version is "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode). I'm thinking maybe 1.7 is not available on Mac. I'm not sure how to recompile offending classes, as I'm relatively new to Java programming. Thanks again for your advice. – mickm Feb 09 '14 at 14:26
  • @Mauren: I've updated to the latest version for Mac (JRE 7U51), which has given my 1.6.0_65. I don't think 1.7 is available yet for Mac. – mickm Feb 09 '14 at 14:30
  • @user3029329 you're probably running both of them, and now 1.6 is the default. I don't know anything about MacOS, but in Windows this is usually solved by changing PATH environment variable to look Java 7 before looking Java 1.6. – Mauren Feb 09 '14 at 14:32
  • @JonSkeet: Thank you for your reply. When following the outlined steps for Mac, in entered '/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home' in the "JRE Home" field, but no corresponding files appeared in "JRE System Libraries" list, leaving me unable to select 'JDK 1.7'. I've updated my system to the latest Java version for Mac (JRE 7U51) which has given me java-version 1.6.0_65. I'm thinking that version 1.7 is not yet available for Mac. From reading HotLicks' comment, I reckon that's why I cannot compile this code. – mickm Feb 09 '14 at 14:35
  • I can't believe that 1.7 isn't available for the Mac. Dunno how you'd install it, though. – Hot Licks Feb 09 '14 at 14:47
  • Thanks to everyone for their help. This issue is now resolved. It appears that even though I had the latest version of Java installed (as per above), it would refuse to use JDK 1.7. I uninstalled Java 6 & 7 from my Mac. I then re-installed version 7. Works like a dream now. Cheers. – mickm Feb 09 '14 at 18:09
  • @user3029329 - The installer probably thought it was already installed, or it was installed in an odd place. I had a problem with my Vista laptop where Java would keep installing the update weekly, but nothing got changed -- finally had to completely delete and reinstall Java, apparently because the Windows path variable was hopelessly mudddled. – Hot Licks Feb 09 '14 at 20:09

0 Answers0