Decompile a Java project and compile

戏子无情 提交于 2019-12-01 14:25:20

There are many ways to achieve this, but I don't think you will be able to import the project inside the jar just out of the box ( in this case, out-of-the-jar ) like that.

We can use the most basic technique ( a bit dirty I admit ) but it works.

  1. Extract the contents of the jar in a directory and decompile it like you done it before
  2. Next, make an empty project inside netbeans ( with no src directory or anything )
  3. Copy the contents of your decompiled project into this netbeans folder. You should now see a skeleton structure of some files. Note The poject is inisde netbeans but it is not a java project yet.
  4. Edit the classpath of the netbeans project and add java library to make it into a Java netbeans project.

The other technique that I use sometimes is that I make all the project files required by the IDE (Eclipse in my case) manually and then tell eclipse to import the project. When eclipse finds all the required files ( .project, .classpath and all ), it imports into the IDE just fine

  1. Create a JavaFX project in your IDE.
  2. Decompile the jar to get the java files. The files will be places in different folders and sub folders based on the packaging.
  3. Put the folders as packages in the project created in step 1 above.
  4. Clean and compile the project in your IDE.

P.S: Make sure you respect the license agreements if you are planning the use the decompiled and recompiled classes in your project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!