Reputation: 7041
When I pack the code in Java in JAR form, will those referenced libraries in Eclipse be packed inside also?
I have run into a tutorial that use import > general > file system to import JAR files instead of external JAR files. Are there any differences?
Upvotes: 2
Views: 11758
Reputation: 1452
Yes, you can right click on Project --> Property --> Java buildpath --> and select library tab and select "Add jar" or "Add External java " into lib folder...
So, it is a very good way to put all libraries into the lib
folder in your project.
Or you also can add a new reference library at a time when you create your new project.
Upvotes: 2
Reputation: 262504
When you export a runnable jar file (using the Export wizard), there is an option to include all dependencies. This is not the default, and it requires some class-loading magic (which Eclipse takes care of under the hood), but if you do that, Eclipse does include all jar files your code depends on and you end up with a standalone jar file. If you create a normal jar file (runnable or not), no dependencies are included.
Upvotes: 4