|Creating A New Eclipse Project Using An Existing JAR File [message #973692]
||Tue, 06 November 2012 14:49
| John Otten
Registered: November 2012
I have a JAR file which holds approximately 150 class files. It contains a GUI to perform particular tasks and I can run it with "java -jar myFile.jar."
I would like to remove the GUI portion to make it a command line program and would like to use Eclipse in conjunction with a decompiler (jd-gui for example) to do so. Basically, I will need to modify and recompile approximately 10 class files to avoid the various GUI calls. (Unfortunately, the functional code appears to be tightly coupled with the GUI, and I can't just write a separate class to make calls to an API and avoid all the class files containing the GUI.)
Although I have a fair amount of experience using Eclipse with C/C++ code, I don't have as much using Eclipse with Java. The past several days I have been trying various ways to get the JAR file into an Eclipse project such that I can add pertinent .java files (which have been decompiled), modify them, and have the project compile them into .class files which then replace the original .class files.
I expect that some problems are because I am setting the build path incorrectly, but I have tried many different settings, and nothing seems to work quite right. Unpacking the JAR file places two class files in the "default" path (actually the top directory) and the rest of the files are in various directories under com.myCompany.etcA etcB and so on. Sometimes the project can see some of the files, sometimes not, but I haven't figured out a way to get the .java files I create (using the same name as the .class files) to be treated as part of the project. I have tried Import, creating new class files, etc. but I am probably missing something in my procedures.
Does anyone have any experience with a similar situation? Or can someone offer any suggestions on how I might proceed? BTW, I am doing this on Ubuntu, if it matters.
Powered by FUDForum
. Page generated in 0.01791 seconds