07-23-2023, 10:31 AM
The Problem is as follows:
I have a Java Application packed in a ".jar"-File.
I can start the App (Swing Application) by either
- doubleclick on the jarfile
- commandline `java -jar MyApp.jar`
However when I put the commandline command into a batchfile, it will tell me
> Unable to access jarfile MyApp.jar
The batch file is in the same directory as the jar. Just where I also started from cmd-line.
I tried to call the bat with Administrator-rights and from an admin-shell - no effect.
I'm working on a Windows 7 (64bit) machine. Any hints will be appreciated.
EDIT
You asked for it :) Here is the batch file:
@ECHO OFF
java -jar MyApp.jar
@PAUSE
EDIT 2
Invoking the batch by double-click and from cmd has the same effect.
Changing the command to
java -jar "C:\Full\Path\MyApp.jar"
has no effect.
EDIT 3
I added `SET Path=%Path%;C:\Path\To\Jar` to the batchfile. No effect.
I also tried using double backslashes as suggested by Chris' link and supported by Viruzzo. Also no effect.
I have a Java Application packed in a ".jar"-File.
I can start the App (Swing Application) by either
- doubleclick on the jarfile
- commandline `java -jar MyApp.jar`
However when I put the commandline command into a batchfile, it will tell me
> Unable to access jarfile MyApp.jar
The batch file is in the same directory as the jar. Just where I also started from cmd-line.
I tried to call the bat with Administrator-rights and from an admin-shell - no effect.
I'm working on a Windows 7 (64bit) machine. Any hints will be appreciated.
EDIT
You asked for it :) Here is the batch file:
@ECHO OFF
java -jar MyApp.jar
@PAUSE
EDIT 2
Invoking the batch by double-click and from cmd has the same effect.
Changing the command to
java -jar "C:\Full\Path\MyApp.jar"
has no effect.
EDIT 3
I added `SET Path=%Path%;C:\Path\To\Jar` to the batchfile. No effect.
I also tried using double backslashes as suggested by Chris' link and supported by Viruzzo. Also no effect.