Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

run .jar with portable(.zip) jre and .bat file (for Windows OS)

3643441Feb 16 2018 — edited Feb 20 2018

Hi all.

I have a follow trouble:

I've wrote simple desktop application, with JavaFX elements (without FXML file).

So, now i want to share my program to my friends, but they are dummies, because i cant explain them how to install JRE. I desided download .zip with JRE, put my program there, and create shortcut for running program from anywhere, with help .bat file (windows) and relative path inside.

To check my idea, i decided to try to make shortcut for demo program, which i've downloaded here: Java SE Development Kit 8 - Downloads (Java SE Development Kit 8u162 Demos and Samples Downloads).

I chose demo program MemoryMonitor (..\demo\management\MemoryMonitor)

I have made .bat file, with follow code:

%~dp0\bin\java -jar %~dp0\App\MemoryMonitor.jar

It's works great.

Then i made same shortcut, but in new i changed name of .jar to my program. And now it doesn't work.

Windows cmd not throws some errors, and running of my program similar at running MemoryMonitor
I can't understand what is reason of it trouble, and why MemoryMonitor works, but my application - not.

structure of folders:

Dir_jre\

     App\

          MemoryMonitor.jar

          MyProgram.jar

     bin\

          java.exe

          ...

Can someone help me with it?

thx.

This post has been answered by RuGI:. on Feb 16 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 16 2018
Added on Feb 16 2018
5 comments
2,391 views