spicymud
asked on
How to make run.bat connect with the jar file on the Start Menu of WinXp
I have written a file "new.java" and changed it into "new.jar";
I also wrote a bat file "run.bat" which content is as follows:
echo off
java -jar new.jar
In the same dir,when I double click the run.bat,the new.jar wil start,the effect of the jar file is that a Dos command window is displayed.
I use a software to make "new.jar","run.bat" and another file "help.doc" into a setup software.And you can use the setup software to install the three files(new.jar,run.bat,help .doc) in some directory.
In the Start Menu of Windows Xp,there are three menus which are linked to these three files.
when I click the menu which is linked to the file of "help.doc",I can soon see the "help.doc" which is installed in one directory.However,when I click the menu which is linked to the file of "run.bat",I can not see the Dos Command Window.The “new.jar" file seems not to run.
so how can I make the menu in the Start Menu of Xp to link to the "run.bat" file correctly so that I can start the "new.jar" file and see the Dos Command Window?
Thanks in advance.
I also wrote a bat file "run.bat" which content is as follows:
echo off
java -jar new.jar
In the same dir,when I double click the run.bat,the new.jar wil start,the effect of the jar file is that a Dos command window is displayed.
I use a software to make "new.jar","run.bat" and another file "help.doc" into a setup software.And you can use the setup software to install the three files(new.jar,run.bat,help
In the Start Menu of Windows Xp,there are three menus which are linked to these three files.
when I click the menu which is linked to the file of "help.doc",I can soon see the "help.doc" which is installed in one directory.However,when I click the menu which is linked to the file of "run.bat",I can not see the Dos Command Window.The “new.jar" file seems not to run.
so how can I make the menu in the Start Menu of Xp to link to the "run.bat" file correctly so that I can start the "new.jar" file and see the Dos Command Window?
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try:
echo off
java -jar \YOUR_FILE_HOME\new.jar
echo off
java -jar \YOUR_FILE_HOME\new.jar
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Right! If you want to make a .jar file out of a .java file (one - to - one) you should do:
javac new.java
jar cvmf Manifest.mf new.jar new.class
Manifest.mf should be a text like:
Manifest-Version: 1.0
Created-By: 1.4.2_03 (Sun Microsystems Inc.)
Main-Class: new
<----------------------- this is an empty line! do not forget to add it.
;JOOP!
javac new.java
jar cvmf Manifest.mf new.jar new.class
Manifest.mf should be a text like:
Manifest-Version: 1.0
Created-By: 1.4.2_03 (Sun Microsystems Inc.)
Main-Class: new
<----------------------- this is an empty line! do not forget to add it.
;JOOP!
And one remark: as classes should have names starting with a Capital letter, your class should be
New rather than new
As a result all files involved should have names New in stead of new.
Second remark: in the above example you add 2 files to the jar: a class file and a manifest.
Every next addition (class files, pictures, sounds ... ) can be added without necessary changes
to the manifest.
The purpose of the manifest is that JAVA (javaw) can find where to start for a "main( )" as the .jar doesn't have
to have the same name.
;JOOP!
New rather than new
As a result all files involved should have names New in stead of new.
Second remark: in the above example you add 2 files to the jar: a class file and a manifest.
Every next addition (class files, pictures, sounds ... ) can be added without necessary changes
to the manifest.
The purpose of the manifest is that JAVA (javaw) can find where to start for a "main( )" as the .jar doesn't have
to have the same name.
;JOOP!
Finally:
Start->Settings->Task Bar & Start Menu->Advanced->Add ..... I think you can add the command
javaw -jar new.jar
Don't forget to supply the right PATHs to javaw and new.jar respectively.
;JOOP!
Start->Settings->Task Bar & Start Menu->Advanced->Add ..... I think you can add the command
javaw -jar new.jar
Don't forget to supply the right PATHs to javaw and new.jar respectively.
;JOOP!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Indeed, if you never installed JAVA on a fresh XP system, you should download
j2re-1_4_2_03-windows-i586 -p.exe
that's the latest release, from
http://java.sun.com/j2se/1.4.2/download.html
(3rd section on the page).
;JOOP!
j2re-1_4_2_03-windows-i586
that's the latest release, from
http://java.sun.com/j2se/1.4.2/download.html
(3rd section on the page).
;JOOP!
I think that a split points would be more appropriate, because objects, GrandSchtroumpf and me
effectivily solved any problem the questioner provided.
;JOOP!
effectivily solved any problem the questioner provided.
;JOOP!
a proper installation of JAVA (JRE) on Windows sets a Registry link from .jar to javaw,
so you can just click a .jar file.
If this is not the case you might install that:
For MSWindows2000:
- Windows Explorer -> Tools -> FileTypes;
Scroll down till you find JAR and select it, then press the Advanced button.
This should pop up a list of Actions, and you'll probably just have one 'open'. Select 'open' and press the 'edit' button on the right. You'll then get (another) dialog showing the action name and the application used to perform the action, something like this:
"C:\Program Files\Java\j2re1.4.1_01\bi
;JOOP!