1
votes

I have two projects in NetBeans that are dependent upon each other, and one references the JAR of the other one. Currently it copies all the JARs it is dependent upon into the dist/lib directory, but I don't want it to copy them--I want it to directly reference the other project's JAR from that dist directory.

How do I do this through NetBeans without manually editing the classpath?

2

2 Answers

2
votes

You might want to look into using Maven for your projects. It's a tool that gives you more control over the build process and clarifies your projects' dependencies. The latest versions of Netbeans come bundled with Maven support.

0
votes

I actually think that this is not possible. The "connection" between projects is for within Netbeans only, while the dist folder is, as its abbreviation suggests, for distribution.

That means that you should be able to simply copy the contents of the dist folder anywhere else, even other machines, and it should work as is (provided there is Java installed, and other such "tiny" dependencies).

If the main JAR in your dist folder would just reference the other dist folder you would not be able to run in on some other machine, unless you would copy the other dist folder in the exact location, etc. which is simply not a good thing to do or to have to do.

So, either go with Maven as MrDrews suggested or accept the libs in dist as a must.