Running Java application from cmd works, from package

The problem is this: I have a Java application packaged in a ".jar" -File.

I can run the application (Swing Application) with

  • doubleclick on jarfile
  • commandline java -jar MyApp.jar

However, when I put the command line command in a batch file, it will tell me

Unable to access jarfile MyApp.jar

The batch file is in the same directory as the bank. Just where I also started with the cmd line. I tried to call the bit with administrator rights and from the shell - no effect.

I am working on a Windows 7 machine (64 bit). Any clues would be appreciated.

EDIT

You asked for it :) Here is the batch file:

@ECHO OFF
java -jar MyApp.jar
@PAUSE

EDIT 2

Calling a package with a double click and from cmd has the same effect. Change team to

java -jar "C:\Full\Path\MyApp.jar"

has no effect.

EDIT 3

SET Path=%Path%;C:\Path\To\Jar . . , Viruzzo. .

+3
4

, , :

, .

MyApp.bak MyApp.bat .

, , .

UPDATE

. : - . . , , .

0

.bat , , .bat, - % AppData%. , (.. java -jar C:\path\to\jar\MyApp.jar).

+1

, hide . , .jar.jar? , ?

0

, , . sleep , .

ping 1.1.1.1 -n 1 -w 10000

( 10 )

0

All Articles