Reputation: 1169
For example, here's the outputted jlink image:
├── bin
│ ├── java
│ ├── keytool
│ └── launcher
├── conf
│ ├── net.properties
│ ├── sdp
│ └── security
├── include
│ ├── classfile_constants.h
│ ├── jni.h
│ ├── jvmticmlr.h
│ ├── jvmti.h
│ └── linux
├── legal
│ └── java.base
├── lib
│ ├── classlist
│ ├── jexec
│ ├── jrt-fs.jar
│ ├── jspawnhelper
│ ├── jvm.cfg
│ ├── libjava.so
│ ├── libjimage.so
│ ├── libjli.so
│ ├── libjsig.so
│ ├── libnet.so
│ ├── libnio.so
│ ├── libverify.so
│ ├── libzip.so
│ ├── modules
│ ├── security
│ ├── server
│ └── tzdb.dat
├── man
│ └── man1
└── release
In the bin
dir, I have the launcher
file which will execute my modular Java application.
My plan is to add more directories such as settings
, work
etc to the outputted jlink image directory. The users will simply get this image as a zip file, and use the launcher
file after unzipping to run my application.
The problem is that I have no idea how to get access to my custom added directories (such as settings
, work
, etc) since the user could unzip this image anywhere. If I could somehow get the location of this image, everything would work great. Perhaps there is a way to figure out the location of java executable (since it would just be the java executable present in the bin
directory) running my program? I'm not sure.
Any suggestions?
Upvotes: 1
Views: 275
Reputation: 1463
For those who reach this question without an answer, use System.getProperty("java.home")
Upvotes: 2