简体   繁体   English

从jar文件生成Javadoc和Java项目的方法

[英]Way to generate javadoc and java project from jar file

I use Netbeans. 我使用Netbeans。 I can make long java projects and then compile them to create a jar file which i can execute independently. 我可以制作长的Java项目,然后编译它们以创建一个我可以独立执行的jar文件。 But given a jar field, can someone tell how i can generate a java project from it and also its java-doc? 但是给定一个jar字段,有人可以告诉我如何从它以及它的java-doc生成一个Java项目吗? Is there an available software that does it or can it be done form within IDE? 是否有可用的软件可以执行此操作,或者可以在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. 就像说我已经编写了一个C ++代码来制作一个.exe文件,并希望做一些事情来从.exe文件中提取出C ++源文件和头文件。 Can that be done? 可以这样做吗?

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. 我假设您正在谈论的文档位于注释(javadocs)中:注释保留在源文件中而不在工件中。

Nonetheless, You can try reverse engineering for your jar: How to decompile a whole Jar file? 但是,您可以尝试对jar进行逆向工程: 如何反编译整个Jar文件?

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. 通过从jar提取.class文件,然后通过反编译器运行.class文件。但是,根据反编译器的信誉程度,不能保证这就是所使用的代码。 Also in terms of javadocs , if the decompiler is able to extract the javadoc comments I am sure you can then create a javadoc . 同样在javadocs ,如果反编译器能够提取javadoc注释,那么我相信您可以创建一个javadoc However if it can not then you are out of luck besides making your own javadoc of the decompiled code. 但是,如果不能这样做,那么除了自己编写反编译代码的javadoc之外,您还很不走运。

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 there 实际上,我有另一种方式可以做到这一点,我认为netbeans找不到它,但是我建立的最好方式是使用Java Decompiler,我可以选择保存所有源代码,在netbeans中创建一个Java空项目,然后然后在其中添加源 在此输入图像描述 .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM