0

I use Netbeans. I can make long java projects and then compile them to create a jar file which i can execute independently. But given a jar field, can someone tell how i can generate a java project from it and also its java-doc? Is there an available software that does it or can it be done form within IDE?

It's like saying i have written a C++ code to make an .exe file and wish to do something to extract the C++ source files and headers back from the .exe file. Can that be done?

userxigement
  • 97
  • 1
  • 3
  • 9
  • You can try opening the `jar` files using a file archiver and extracting the `class` files. You could then use a Java decompiler such as Cavaj to attempt to retrieve some meaningful source code. – Spooky Feb 09 '15 at 20:52
  • thx, all the comments and answers have helped me a lot. I will randomly choose a right answer. – userxigement Feb 09 '15 at 21:07

3 Answers3

0

Nop, you can't. I am assuming the documentation you are talking about is in the comments (javadocs): The comments stay in the source files and not in the artifacts.

Nonetheless, You can try reverse engineering for your jar: How to decompile a whole Jar file?

Community
  • 1
  • 1
lmiguelmh
  • 3,074
  • 1
  • 37
  • 53
0

You can always try to decompile the code. By extracting the .class files from the jar then running the .class files through a decompiler.. However depending on how reputable the decompiler is, there is no guarantee that, that is exactly the code that was used. Also in terms of javadocs, if the decompiler is able to extract the javadoc comments I am sure you can then create a javadoc. However if it can not then you are out of luck besides making your own javadoc of the decompiled code.

jgr208
  • 2,896
  • 9
  • 36
  • 64
0

actually i have another way to do it i think i couldn't found a way to do it by netbeans, but the best way that i founded was using Java Decompiler i has an option save all sources, create a java empty project in netbeans and then add the source thereenter image description here.

jorgevasquezang
  • 1,008
  • 1
  • 9
  • 16