• Post Reply Bookmark Topic Watch Topic
  • New Topic

Batch file (. BAT) problems with some relative folders.  RSS feed

 
Marvin Legend
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Batch file (. BAT) problems with some folders on.

Hello guys,

I created an application in Java and put the JRE folder within the application, because some users do not have Java installed on your machine and the way I did, my application runs. JAR with the JRE that is contained in my application ., with this I'm not having problems, but I created a BAT file that contains the following command:

start "" jre8 \ bin \ javaw-jar app.jar

So I run my program in java through the file. BAT calling JRE that is inside the folder and then this JRE runs the mine. JAR and works great anywhere in windows, worked well on a USB key with this command is within. BAT (start "" jre8 \ bin \ javaw-jar app.jar).

But I'm having trouble running this. BAT in certain folders, eg Program Files and Program Files (x86), I need this code to be able to find any directory, regardless of whether the directory has spaces in the name, symbols, numbers or anything else, because maybe people will put the application folder to another location or rename the folder, and if this happens the program will stop working? Too bad agree? And especially do not give problems to run inside the Program Files and Program Files (x86) because the application runs everywhere except in these two folders.

Thank you very much!
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could be you don't have the appropriate access rights as those 2 folders have restricted write access in Win 7 and 8 (not sure about XP).

What actually happens when you try to run the program from those locations?
What version of windows are you using?

 
Knute Snortum
Sheriff
Posts: 4279
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't really a Java issue, I don't think, but I'll take a crack at it.

I'm assuming the command you're running is start "" jre8\bin\javaw -jar app.jar. The spacing is a little weird, so I'm just making sure. So you install your application, for instance, in C:\program Files\MyApp, assuming your application is call "MyApp". If you've created a jre8 in C:\program Files\MyApp then I would just change the command to start "" .\jre8\bin\javaw -jar app.jar. There is probably some other jre8 folder in the PATH.

That's my guess.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!