However the finished jar file could not run anywhere else as it did not package the referenced libraries in itself.
Exporting a runnable java application from Netbeans does not works out of box, as you need to export the entire dist folder that contains the distributable .jar file as well as the lib folder containing the dependant jars. In order to do so, I devised the following method that saved me a lot of time.
- First, create an application in Netbeans and build it.
- Open eclipse and create an empty java project.
- Copy the source folder contents to create the equivalent project in eclipse.
- Copy the jars and set the build path to fix the compile errors occured by missing reference.
- Check whether the exported project works in eclipse.
- Finally export the eclipse application as a runnable jar.
There are other methods ; i.e: Changing the jar file manifest, copying the referenced jar contents into the final jar, but these are more error-prone than this one.
No comments:
Post a Comment