Creating jar file

Need help im taking the java course and at the end of section 1 i need to pack my files as a jar file, the problem is i get this error message

“tim/com/Main has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0”

and have try to update my jdk deleting it etc. but it keep coming i can find solution anywere on the internet so please help me someone!!

Hi,
Your attempt makes sense.
Can you recompile the code with your current version?

Did not do that in years but basically a jar can be created manually using the javac command with -jar switch.
I don’t know what IDE you’re using but there is certainly a way to create a jar from there.

If this is not sufficient clean your project output before recompiling.
Compiler may detect no new change to code and bypass actual compilation.

Regards.

thanks for the answer…

i have intellij and i found out that i didnt had the newest version of java runtime so it is fix now :smiley:

1 Like

Cool.
True that you may have several versions of the SDK on a machine and you need to make sure your project/IDE uses the one you expect.
I did clean most of my .NET SDKs because I aim to stick with LTS version. but you still need to keep a few for compatibility.

image