This content has been marked as final. Show 4 replies
In NetBeans 6.5.1, I have added some jar(to be specific [log4j-1.2.15.jar|http://gpraveenkumar.wordpress.com/2009/05/01/download-and-install-log4j-log-for-java/] ) files by importing them. I have written a post on how I imported these in my blog. Check out, may be they are helpful.
G Praveen Kumar
Edited by: gpraveenkumar on Jun 29, 2009 7:14 AM
You rightclick your project, then properties, and there libraries and add Project, if you want another NetBeans project to be compiled with this one. If you have compiled stuff already, you can add it with another button called add Jar. The later one won't link any NetBeans project to be compiled, but each will create a lib folder in your dist folder where your .jar file is, and put everything there, then add it relatively into the classpath of your jar. So you can link external libraryes this way.
Another way to add other folders under sources in the properties window, then each folder will be included into your jar file, but they will share the same classpath. This is only a problem if they use "default package" what isn't recommended anyway.
The dirty hack of the two can be if you set the compile dependency, then add the other project's dist folder into your projects' source folders. Then you'll get another jar inside yours. This usually isn't useful because you can't access it by default, but if you have to send it over the web or write it out into the disk instead of executing it right away, you can get an included jar as a data stream very easily this way. This combination is not supported officially and may fail!
In case this hack fails, you can always use a zip program to copy a jar into another one directly.