-1

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

  • 1
    So perhaps the file is corrupted? Have you tried obtaining a fresh copy? Or tried running that copy on another computer? – Basil Bourque Mar 25 '21 at 21:17
  • Sounds like no application entry point is given. Checkout the manifest file in the jar. It should have an entry for the main class. – The_Cute_Hedgehog Mar 25 '21 at 22:27
  • Start with `unzip -c yourfile.jar META-INF/MANIFEST.MF` to check the JAR's manifest file. That should output something readable that lists a `Main-Class:` entry. To see the entire contents of the JAR, `unzip -l yourfile.jar`. – AndrewF Mar 26 '21 at 01:51
  • Please add details to your question about what "open a .jar-File" means to you. The CleanCode project I know of is for a set of libraries. It does not have any code for you to run. What is your actual goal of double-clicking on this JAR file? What would you like to do with this file? – AndrewF Mar 26 '21 at 01:55
  • Thanks for the answers. I have downloaded this File vom OneNote. The CleanCode.jar is a exercise with the target, that i can clean the Code with the code-rules and have no sense. The file works on the PC from the other students and I have download it again to ensure that the file is correct. I would like to open the File in eclipse (Sorry, I have lost my way and have missed my finally target in the question :)). I have add my eclipse-specifications. – anonymoushuman Mar 26 '21 at 09:59
  • You cannot open a JAR file in Eclipse and edit it. You need the sourcecode if you want to do that. You could decompile all classes in the JAR file, and then work on that decompiled source code though, if that's what you want. – dunni Mar 26 '21 at 10:05

1 Answers1

0

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.