nus-cs2113-AY2021S2 / forum

5 stars 0 forks source link

Linkage Error in my ip jar #41

Closed Leeyp closed 3 years ago

Leeyp commented 3 years ago

My teammate tried my jar and he got this error on my jar:

Error: LinkageError occurred while loading main class duke.Duke java.lang.UnsupportedClassVersionError: duke/Duke has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Why does this happen, is this a problem?

How to fix this problem, if it is not acceptable problem?

okkhoy commented 3 years ago

This happens if you compiled using Java 14 instead of Java 11. This is a problem because the cohort is expected to use Java 11 for the project, and others would be (hopefully) using Java 11. When they can't open the JAR file, you get 0 for "being untestable"

How to fix: set up the right version of Java on your IDE (machine can have multiple java installed, ensure IntelliJ uses JDK 11) and recompile.

Leeyp commented 3 years ago

Dear Prof,

Thank you for your advice. Seems like that was a careless mistake that could have led to very disturbing and urgent consequences!

Do I have to fix all my commits for all my previous IP work? Since, if the TA checks, then it would be disturbing if they cannot run my code for something like Level-1 or Level-6, etc? Or is that fine, since only my final Jar is being graded?

Thank you so much!

okkhoy commented 3 years ago

Ah... it doesn't affect the code (since most API in Java 14 are in Java 11). Just rebuild the JAR.

Leeyp commented 3 years ago

Ok, thanks prof!