0

I am stuck creating a jar file. I would be glad if someone could help me out with this issue.

Here's the thing: I am trying to create a runnable jar file but it shows me the message saying -

VM arguments will not be part of the runnable JAR. Arguments can be passed on the command line when launching the JAR.

I tried using different solutions available on this website. I tried creating a bat file and it executed with 7 errors (at last it specifies as failed to run or load main class) whereas in eclipse this program is running fine. I also tried using the launch 4j; it shows an error saying -

failed to load the SQL JDBC auth.dll cause: no SQLJDBC auth.dll in the library path.

Sampada
  • 2,931
  • 7
  • 27
  • 39
  • You can create the Jar and it doesnt open or you cant create it? Do you use arguments (like String[] args of the main) in your program? – Simone C. Jul 05 '16 at 18:49
  • if its just a jar i can create it but it pops out an error saying unable to load main class, but when i tried creating the runnable jar it showed me VM arguments will not be part of the runnable JAR. Arguments can be passed on the command line when launching the JAR. yes i do use string []args – neshanthkalaichelvan Jul 05 '16 at 18:54
  • thank you for the reply. i found the solution for my problem. I had to add the path of dll in environment variable/path. then it worked – neshanthkalaichelvan Jul 06 '16 at 14:19

1 Answers1

0

You have to launch your .jar not by double clicking on it, but trough the console like this:

java -jar myjar.jar arg1 arg2

And you retrieve your arguments in the code like this:

 String arg1 = args[0];
 String arg2 = args[1];

Thanks to Rajesh Pantula: Run jar file with command line arguments

Community
  • 1
  • 1
Simone C.
  • 369
  • 4
  • 14