質問

I have a java project that I developed in Netbeans. Because I was the only developer and it's a simple project (one source file, but it needs several specialty libraries) I didn't use source control.

I'm no longer going to be working on the project, and want to hand it over to someone else in case they need to make changes to it in the future. I don't think it will be sufficient to just zip up the project folder and send it to her, as the project points to libraries located elsewhere (multiple locations) on my computer. Is there a way to direct Netbeans to create a shareable copy of the project that would include copies of all the libraries, with the required pointers? (There are copies of the libraries in dist/lib, but I'm pretty sure that's not where Java looks for them when building the project.)

Would Export Project -> to ZIP from the File menu do what I need here?

役に立ちましたか?

解決

If you want to export the project so that it will be reopened from a NetBeans IDE:

  • Right click your project and choose to create a new folder. Name it lib and press OK. You will be able to see the folder if you go to the Files tab.

  • Then put (copy) your libraries there.

  • Then go back to projects tab and right click the libraries node. Choose add JAR/Folder and point to where your jar you want to use is (inside the lib folder). Select the file and also make sure that you choose the Reference as: Relative Path option. Click open.

  • You will now be able to see your library if you expand the libraries node of your project.

  • Select your project and then choose Export project to ZIP from the file menu.

Thats it.

If you extract the created zip file you will see the lib folder with all the JAR files in it. Also if you go to the nbproject and open the file project.properties you will see some lines like file.reference.dom4j-1.6.1.jar=lib\\dom4j-1.6.1.jar. I believe this is how Netbeans knows where to find the libraries you need.

If you want to migrate to Eclipse: http://www.coderanch.com/t/458555/vc/Export-Netbeans-Eclipse

If you want to be general then you should build your project with Maven or Ant. Every modern IDE (Eclipse,NetBeans,InteliJ) can understand these building tools.

Hope it helps you.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top