Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wrldwzrd89

macrumors G5
Original poster
Jun 6, 2003
12,110
77
Solon, OH
ARRGH, this is driving me bonkers. I'm trying to create a NetBeans project that depends on another NetBeans project, that depends on an external JAR. However, I cannot get the first project to run. All projects compile properly, but the first project cannot see the JAR file the second project references, for some reason. :confused:
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Check the manifest.mf under meta-inf in your primary projects jar file, and see where it is expecting its dependencies to be. I think by default it is in a subdirectory called lib. So if you have myproject.jar in your home directory, you would need to have a subdirectory called lib that has all third party libraries as well as the jar file for your project.

-Lee
 

wrldwzrd89

macrumors G5
Original poster
Jun 6, 2003
12,110
77
Solon, OH
Check the manifest.mf under meta-inf in your primary projects jar file, and see where it is expecting its dependencies to be. I think by default it is in a subdirectory called lib. So if you have myproject.jar in your home directory, you would need to have a subdirectory called lib that has all third party libraries as well as the jar file for your project.

-Lee
You are correct - it is looking in a folder called lib, inside the dist folder. However, I wish there was a way to auto-propagate referenced JARs in one project to other projects that use that project - this would be ideal, and would make things work properly.

As things are right now, even if I manually copy the JAR files to the dist/lib folder of the main project, it won't find them.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
You are correct - it is looking in a folder called lib, inside the dist folder. However, I wish there was a way to auto-propagate referenced JARs in one project to other projects that use that project - this would be ideal, and would make things work properly.

As things are right now, even if I manually copy the JAR files to the dist/lib folder of the main project, it won't find them.

My approach when I was using NetBeans was to add the jar from the dependencies dist directory to the depending project. Then, when you do a build of the depending project, it should copy that jar to the dist directory.

As long as /lib is in manifest.mf in the CLASS-PATH line, it should pick up your jar if you put it there.

-Lee
 

wrldwzrd89

macrumors G5
Original poster
Jun 6, 2003
12,110
77
Solon, OH
My approach when I was using NetBeans was to add the jar from the dependencies dist directory to the depending project. Then, when you do a build of the depending project, it should copy that jar to the dist directory.

As long as /lib is in manifest.mf in the CLASS-PATH line, it should pick up your jar if you put it there.

-Lee
I agree, that should work... but NetBeans isn't copying the JAR file from wherever it is on the disk to the dist folder of the dependent project in the first place. If I add the JAR file to the dependency list of BOTH projects manually, it'll work properly, but this configuration is far from ideal for release purposes - i.e. the development build will work but the release build will fail.
 

wrldwzrd89

macrumors G5
Original poster
Jun 6, 2003
12,110
77
Solon, OH
I've been experimenting with this but cannot, for the life of me, get it to work as I want it to... anyone else have ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.