Rupesh Krishna
asked on
How to create a jar files and batch file in SWING?
How to create a jar files and batch file for multiple class files in SWING.
How to create a jar file for multiple class files and how to create a batch file to run the application(jar).
When we run the batch file how to hide the dos command screen?
How to create a jar file for multiple class files and how to create a batch file to run the application(jar).
When we run the batch file how to hide the dos command screen?
Steps to follow when making an executable jar on Windows:
Let's assume You have Your project classes at the path C:\Project\classes
There is a directory of various classes and packages. Say the class containing starting method 'main' is this:
C:\Project\classes\mypacka ge\Main.cl ass
1. create a file, say 'manifest.txt' in C:\Project\classes, write the line:
Main-Class: mypackage.Main
Note: after writing the line, press Enter, so that another empty line would be created, now save the file.
2. start the command line and cd into C:\Project\classes. Run this command:
jar cvfm App.jar manifest.txt .
At this point the App.jar file is created. You can test if it runs while double clicking on it. If nothing happens, You should add an entry "." to Your CLASSPATH environment variable. If You need help on the latter, just say so.
Let's assume You have Your project classes at the path C:\Project\classes
There is a directory of various classes and packages. Say the class containing starting method 'main' is this:
C:\Project\classes\mypacka
1. create a file, say 'manifest.txt' in C:\Project\classes, write the line:
Main-Class: mypackage.Main
Note: after writing the line, press Enter, so that another empty line would be created, now save the file.
2. start the command line and cd into C:\Project\classes. Run this command:
jar cvfm App.jar manifest.txt .
At this point the App.jar file is created. You can test if it runs while double clicking on it. If nothing happens, You should add an entry "." to Your CLASSPATH environment variable. If You need help on the latter, just say so.
ASKER
When we execute jar file we are getting the dos screen. I want to hide that dos screen when we run the jar(application)file.
Once we get the short cut for bat file its easy to hide the window.
But after auto installation the bat file shortut created by setup generator.
Can we control the shortcut file or bat file before creating setup file.
Once we get the short cut for bat file its easy to hide the window.
But after auto installation the bat file shortut created by setup generator.
Can we control the shortcut file or bat file before creating setup file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry objects, didnt see you there.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>How to create a jar file for multiple class files and how to create a batch file to run the application(jar).
Use the command jar cfm App.jar abc.mf *.class
Here abc is your manifest file.
Create a file with the following command java -jar App.jar . here App is the name of your Application jar file. Write this command in a note pad and save it as a bat extension. and try to run it.
Use the command jar cfm App.jar abc.mf *.class
Here abc is your manifest file.
Create a file with the following command java -jar App.jar . here App is the name of your Application jar file. Write this command in a note pad and save it as a bat extension. and try to run it.
ASKER
Hi paramu83
I wanna make the the dos screen invisible when executing the application with out setting the proprties of short cut of the batch file
Thanks for your suggestions
I wanna make the the dos screen invisible when executing the application with out setting the proprties of short cut of the batch file
Thanks for your suggestions
Use JAVAW instead of JAVA !!!!
colr__
colr__
ASKER
Hi colr__
I have tried that its not working
I have tried that its not working
Can you print the batch file you've got? I use this all the time and it definetaly works.
Are you running your batch file from DOS? If so then you cant get the DOS window to dissapear, but if you double click the batch file, it will open the DOS prompt, start the application, then close the DOS prompt while the program is still running.
You wont be able to start the program from a DOS prompt and have that DOS prompt closed.
colr__
Are you running your batch file from DOS? If so then you cant get the DOS window to dissapear, but if you double click the batch file, it will open the DOS prompt, start the application, then close the DOS prompt while the program is still running.
You wont be able to start the program from a DOS prompt and have that DOS prompt closed.
colr__
Try putting a & at the end of the command to run it in background mode.
ASKER
Thnks colr__
I will try that and let you know
I will try that and let you know
Heres one I use:
start /B javaw -classpath .;".\JSE\mysql-connector-j ava-3.1.11 -bin.jar" Start > error.txt
start /B javaw -classpath .;".\JSE\mysql-connector-j
Did you tried my suggestion : start javaw ?
Jar:
http://java.sun.com/j2se/1.5.0/docs/guide/jar/index.html