Can not open .jar File on Macbook

Tags: ,



I have a new MacBook Air with the M1-CPU. I have installed eclipse and I can code with the IDE, but I can’t open a .jar-File because it is grayed out. My target is, to open the file with eclipse, so that i can edit the file.

Eclipse-specifications:

Version: 2020-12 (4.18.0) | Build id: 20201210-1552

When I would try to open the .jar file without a IDE it comes a Error with the massage:

“CleanCode.jar” cannot be opened because it comes from an unverified developer.

Then I opened it with control:

macOS cannot verify the developer of “CleanCode.jar”. Do you really want to open the app?

I accepted and then comes this Error:

Failed to launch the Java app.

In the Console I run this command:

java -jar Downloads/CleanCode.jar

And the Output was this:

Error: Invalid or corrupt jarfile Downloads/CleanCode.jar

My Settings:

java –version

Output: java 16 2021-03-16

I have installed Java SE Development Kit 16 for Mac and this Java Version 8 Update 281

Answer

I have solved the problem. I do not have to click on “open”, I have to click on Import. After I need to check the “Existing Project into Workspace” under “General”. Then I can select the Jar-File as a Archive file and can open it.



Source: stackoverflow