0

I am using Launch4j with a bundled jre version. The path of the jre version has to be configurable, so I though using the .ini file. I don't understand the documentations on the launch4j website, so I'm coming here for help.

Here is the part of my launch4j config:

<jre minVersion="1.6.0">
    <path>%JRE_PATH%</path>
    <jdkPreference>preferJre</jdkPreference>
</jre>

and this is in my myapp.l4j.ini:

-JRE_PATH="D:\builds\jre"

But the exe file always says:

This application was configured to use a bundled Java Runtime Enviroment but the runtime is missing or corrupted

The JRE_PATH variable should be added into the path-element at runtime.

What am I doing wrong?

M A
  • 65,721
  • 13
  • 123
  • 159
Franz Kafka
  • 9,999
  • 17
  • 86
  • 145

2 Answers2

3

I took a look at launch4j documentation for its configuration file and also for additional JVM options (which is where xxx.l4j.ini is mentioned).

I think you are misunderstanding what you can do with the .ini file. I think it is just intended as a place where you can specify runtime JVM options (e.g. -D and -X args) for your application. I don't think it's a general purpose variable declaration file.

I don't think that it is valid to use an environment variable in the XML configuration file (%JRE_PATH%). The documentation says this should be a relative or absolute path. I don't think variable substitution is supported in the XML configuration file.

sudocode
  • 15,747
  • 38
  • 58
  • I think you are right there. That is too bad. Now I always have to tell my customers: Put your jre exactly 2 directories higher. That would have been a nice thing to have – Franz Kafka Jun 03 '11 at 08:14
  • I'm just reading docs, not trying it. But take a look again at the configuration file doc at the section on the `` tag. Looks like you can persuade launch4J to search for a JRE/SDK if you don't specify `` or if it is not found there and you specified `` and/or ``. – sudocode Jun 03 '11 at 09:13
0

AFAIK the path to the jre is not configurable by the user in the .ini file but you can bundle the jre with your app and specify in the .exe where it is.

See this.

Community
  • 1
  • 1
Francisco Puga
  • 20,593
  • 4
  • 43
  • 56