如何在NetBeans上编辑库源文件? [英] How to edit library source files on NetBeans?
问题描述
我正在做基于SSJ(Java中的随机模拟)库的JAVA项目。在我的项目中,我已按照所需的步骤导入SSJ库文件以及源文件。
I am doing JAVA project based on the SSJ (Stochastic Simulation in Java) libraries. In my project I have followed the required steps to import the SSJ library files and also the source files.
查看项目的Libraries分支中的SSJ库文件时,仅类文件显示出来,但是当我打开它们时,我可以查看源代码(之前我没有,因为我没有导入源代码)所以我假设所有内容都已正确导入。
When looking at the SSJ library files in the project's Libraries branch, only class files appear shown, but when I open them I can view the source code (which I couldn't before, as I hadn't imported the sources) so I assume everything was imported correctly.
当我运行库提供的示例时,一切运行正常并且符合预期。但是,如果我尝试更改库的源代码,例如更改输出上的文本,我对源文件所做的更改不会反映在java程序的输出中。
When I run the examples provided with the library everything runs fine and as expected. But if I try to change the source code for the libraries for instance, changing the text on an output, the changes I make to the source files aren't reflected in the output from the java programs.
我可能做错了什么提示?
Any hint on what I might be doing wrong?
我知道这可能很难理解或测试,因为我无法创造和SSCCE就此事。库文件存放在这里(http://www.iro.umontreal.ca/~simardr/ssj/ssj-20120216.zip)和源代码(http://www.iro.umontreal.ca/~simardr) /ssj/ssj-source.html)。
I understand this might be hard to understand or test as I can't quite create and SSCCE for this matter. The library files are hosted here (http://www.iro.umontreal.ca/~simardr/ssj/ssj-20120216.zip) and the source code here (http://www.iro.umontreal.ca/~simardr/ssj/ssj-source.html).
提前感谢您的帮助!
推荐答案
将库添加到库中是为了调试和记录目的。这并不意味着Netbeans会自动检测更改并重新编译类。
Adding source to libraries it's for debugging and documentation purposes. It does not mean that Netbeans will detect changes and recompile classes automatically.
您应该为库本身创建一个项目,以便从源代码重新创建它。更改是,如果您有源,将有一个 build.xml
或一个包含这些步骤的 pom.xml
编译库并允许创建 Java自由格式项目或带有现有POM的项目。
You should create a project for the library itself to recreate it from source. Changes are that if you have the source there will be a build.xml
or a pom.xml
that contains the steps to compile the library and will allow to create a Java Free Form Project or a Project with existing POM.
然后删除对库本身的引用并为项目添加依赖项。
You'd then remove the reference to library itself and add a dependency to the project.
其他选项将库源添加到您正在使用的同一个项目中(同样,删除对库的引用)但我不推荐这个,除非它是一个非常小的简单库。
Other option would be to add the library source to the same project you are using (and, again, removing reference to the library) but I would not recommend this unless it's a very small simple library.
编辑。特定的ssj信息。
ssj
是一个原始源代码位于<$ c的库$ c> .tex 文件,它需要几个程序来生成 .java
文件,然后编译它们。所有这些信息都可以在 COMPILE.txt
原始文件中找到。
ssj
is a library where the original source code is in .tex
files and it requires several programs available to generate .java
files and then compile them. All this information can be found in the COMPILE.txt
original file.
由于源代码分发包含 .java
文件只能使用Netbeans生成 .jar
,但需要修改 build .xml
只编译Java源文件。此外,在创建 Java Free Form Project 时,需要选择 lib
作为 Build Project 的目标。
Since the source distribution includes .java
files it is possible to generate a .jar
just using Netbeans but it requires to modify the build.xml
to just compile Java source files. Also when creating the Java Free Form Project is necessary to select lib
as the target to Build Project.
这是一个 minimal build xml for Netbeans 7.1从Java源代码编译。
Here it's a minimal build xml for Netbeans 7.1 to compile from Java sources.
这篇关于如何在NetBeans上编辑库源文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!