0

I am currently taking a class that requires me to use code created by the professor, but I've run into an issue. Whenever I try to run code that uses the professor's code, i get the following message:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: cs/comsc331/ppm/PPM has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I know what's causing this, as it tells me - my Java needs to be updated. However, when I go to do so, both Eclipse and the Java Control Panel tell me that I'm all set with the most recent version. I went looking, and on java.com it told me to download Version 8 Update 241, which I did, but nothing changed. When I started looking online for solutions, I came across a post that briefly mentioned that Eclipse would not run with a more recent Java on my system then Java 8.

It seems that I'm at an impasse - I either need a way to update Java without breaking my setup (I tried downloading a more recent version than Java 8 and Eclipse wouldn't start), or I need a way to run newer code on my older system, potentially by recompiling it myself (I tried doing this once and I couldn't figure it out so I could use some advice if this is the best way forward). If I have to recompile the code myself that's okay as there aren't a huge amount of files, but the more efficient the method, the better.

Updating to a newer OS is not an option (if that would even help) because when I've tried to do so in the past, my laptop had to be completely reset (something about it being to hold to handle the new way that files were being done? the explanation I received was unclear).

In the super short term, I've just been straight up copying the code into new files and compiling it on my own, but my professor wants us to work within the existing packages, so that is a bandaid more than anything else. Long term, I need a new laptop that can be fully updated (I got my current one in 2015) but I would assume that there's a more reasonable solution out there.

Thanks!

Ally
  • 1
  • Recompiling it yourself is almost certainly the best option. Please explain in detail what happened when you tried that. – Joseph Sible-Reinstate Monica Feb 13 '20 at 02:57
  • 2
    You will need to recompile the code your professor has provided, or you need to upgrade to [Java 13](https://stackoverflow.com/a/11432195/2970947). You will not be able to use classes compiled with Java 13 with an earlier version of Java. While I'm sorry you have trouble upgrading your OS and your environment, it is **time**. – Elliott Frisch Feb 13 '20 at 02:57
  • Would you know what version of Java your professor is using? i.e. java 8,9,10,11,12, or 13? –  Feb 13 '20 at 03:18
  • 3
    @Dalton `class file version 57.0` means **Java 13**. See https://stackoverflow.com/a/11432195/5221149 – Andreas Feb 13 '20 at 03:19
  • If you can't upgrade to Java 13, you have no choice but to recompile those classes. But beware that code designed to run on Java 13 *might* use Java SE classes and methods, or language features, that are not present on Java 8. If so, it won't compile. – Stephen C Feb 13 '20 at 06:59
  • @Andreas thank you so much. Learned something new today! –  Feb 14 '20 at 05:00

0 Answers0