Reputation: 2259
I have created a Javafx project named MyProjectName in Netbeans 7.4 and I have added some external jars. Its running fine from Netbeans. After Clean and Build dist folder is created and few sub folder is created like 1-lib(containing all external jar file), 2-run321...(containing MyProjectName.jar,jnlp,html...etc), 3-webfile, 4-MyProjectName.html, 5-MyProjectName.jar(this executable jar), 6-MyProjectName.jnlp MyProjectName.jar(5-MyProjectName.jar(this executable jar)) running fine from dist folder.
But when i copy MyProjectName.jar somewhere else and try to run, it is not running . It show Message Exception while running the application. But when i put lib folder(1-lib(containing all external jar file)) it is running fine.
How can i run it only from MyProjectName.jar???
Upvotes: 1
Views: 2152
Reputation: 1
Execute a .jar without the lib directory is imposible, because your main .jar will need those .jar depended files. If you need to move your MyProjectName.jar somewhere else and try to run it, you must move the lib directory too, or prove Thusitha' solution.
Upvotes: 0
Reputation: 8657
Try to use this command:
java -jar MyProjectName.jar
This may help you.
Upvotes: 1
Reputation: 5712
that is because you need those dependency jar files. you can create a jar file by combining all those external jars Try out this
Upvotes: 1