Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open a jar file in Eclipse

Tags:

java

eclipse

I downloaded a demo jar file, and would like to open it in eclipse. What I did is

import->Existing projects into workspace ->select archive file

However, the eclipse returns "No projects are found to import".

As command line, I type

java -jar projectDemo.jar

This jar file just functions well. So it seems to me that jar file itself is OK, but how can I open it in Eclipse and modify this demo code? Thanks.

like image 944
user630983 Avatar asked Aug 02 '11 19:08

user630983


People also ask

How do I view the contents of a JAR file in Eclipse?

If the JAR is added to the build path of your project, you can just click it open in the Package Explorer on the left side of the screen.


2 Answers

Since the jar file 'executes' then it contains compiled java files known as .class files. You cannot import it to eclipse and modify the code. You should ask the supplier of the "demo" for the "source code". (or check the page you got the demo from for the source code)

Unless, you want to decompile the .class files and import to Eclipse. That may not be the case for starters.

like image 166
Mob Avatar answered Oct 06 '22 13:10

Mob


use java decompiler. http://jd.benow.ca/. you can open the jar files.

Thanks, Manirathinam.

like image 38
Mani Avatar answered Oct 06 '22 11:10

Mani