Generated Exe Configuration

Generated exe file is configurable for extra options


Overview

After an exe file has been generated, it is configurable for extra options, such as Java vm parameters, or options defined by Jar2Exe. Generated exe file is configured through a Configuration File, which is a text file in the same directory as generated exe file.


Internal Config & External Config

The configurations can be internal in the exe file [since 2.0.3], or outside in a configuration file, or both. The configuration file outside is a text file in the same directory as generated exe file, with the same filename plus a extension name ".cfg" or ".config".

 You can click "Config Internal" at Step 6: Output to make configurations inside the exe file, or click "Config External" at Step 7: Finish to make a configuration file outside, or both.

If the exe file has been generated, you can start 'Config Assistant' from Start Menu and select the exe file you want to configure. Config Assistat will load the current configuration if exists, and it will help you to save the configuration file.


Configuration File Content

The configuration file is a text file, each line is a configure item. The format of configure item is "keyword value". If a line is not started with a known keyword, this line is ignored.


Refer to Environment Variable by %VARNAME% or $VARNAME

In the configuration file, you can use a placeholder to refer to environments. Generated exe supports Linux style placeholder $PATH and Windows style placeholder %PATH%. For example:

option -Dpath.string=$PATH

is to define a System Property "path.string", the property value is the environment variable PATH.

There are serveral internal placeholder, which is not from environments:

  • $APPLICATION_HOME - The directory where the generated exe file is.
  • $J2E_APP_PATH - The full path of generated exe file.
  • $PWD - The current working directory.

If you want to express '$' character itself, not to be regarded as a placeholder, use '$$' to stand for '$' character, '%%' to stand for '%' character.


Refer to Windows Registry by ${REGISTRY_PATH\Item}

This is for Windows only, since Jar2Exe V2.1.3. In configure file, you can refer to Windows Registry by a placeholder. The syntax is:

${REGISTRY_PATH\Item|default}

If the "REGISTRY_PATH" not found or "Item" not found, the "default" value will be returned. To get the "(Default)" item, leave "Item" empty like ${REGISTRY_PATH\|default}. The "|default" can be omited, if there is no "|default", the whole placeholder will not be translated if the REGISTRY_PATH or Item not found.


jre_order

'jre_order' is to configure the JRE Find Order. The default order is "cbsie", each letter stands for a search way:

  • c - Configured JRE by 'jvmdll'
  • b - Bundled JRE path by 'jre' item
  • s - Installed SUN JRE (Windows) / or 'java' symbol link (Linux)
  • i - Installed IBM JRE (Windows)
  • e - Environment JAVA_HOME or JRE_HOME

If jre_order exists in configuration file, generated exe will find JRE in the order specified.

  • See jre_order page for detais JRE find order.

jvmdll

In configuration file, 'jvmdll' is used to specify a JRE, through an absolute path or relative path to "jvm.dll" on Windows, "libjvm.so" on Linux.

  • See jvmdll page for details of specifying a JRE by path.

jre [since 2.0.3]

In configuration file, 'jre' is used to specify a JRE like 'jvmdll', through an absolute path or relative path to "jre" directory or "jdk" directory.

  • See jre page for details of specifying a JRE by path.

vm

Configure item 'vm' is to specify a preferred vm, "server" or "client". Generated exe will try to select the preferred VM first, except the JRE is specified by 'jvmdll'.

  • See vm page for selecting a preferred vm.

minjre

Jar2Exe supports to set a minimum java.version for generated exe, such as 1.2, 1.3 etc.

In configuration file, you can use 'minjre' to set a new value to overwrite the value during generating. As you need, you can set a more precise value, e.g. "1.6.0_10"

  • See minjre page for details of minimum java.version configuration.

option

The 'option' item is used to set java vm parameters defined by JRE. For example: "option -Xmx1024m", "option -Dhello.string=Hello" etc.

  • See option page for details of defining java vm parameters.

property

The 'property' item is used to define a System Property, it is equalent to "option -D".

  • See property page for details of defining System Property.

forcecwd

The 'forcecwd' item is to set the current working directory with a relative path from generated exe, or an absolute path.

  • See forcecwd page for details of setting current working directory.

classpath, libs

The 'classpath' item is to add jar files to java classpath. The 'libs' item points to a directory, in which all jar files will be added to java classpath.


export

To define a environment variable which can be referred by other configure item through placeholder, or can be gotten by System.getenv() within java code.

  • See export page for details of defining a environment variable.

stdout, stderr

To set a file or pipe for System.out and System.err to be redirected to.

Comments

UI Scale using JFXPanel

Dear Ladies and Gentlemen,

I use Swing and would like to use the FileChooser by javafx.

My application I start as exe converted with Jar2Exe. The surface is scaled correctly according to the setting under Windows 10 for example 150%.

The use of FileChooser requires the initialization of a JFXPanel. The call immediately resets the scaling without errors. However, the display is now much too small for high-resolution displays.

The scaling is done already when I the command
Code:
PlatformImpl.startup (() -> {})
;. This is important for the initialization of the toolkit from javafx.

The problem happens exactly
Code:
com.sun.javafx.tk.Toolkit.getToolkit (). Startup (() -> {});
This is however native.

Is there a property, a flag, or other to reset or ignore.

I hope someone can help me I've already researched a lot on the Internet.

JVM Config

Hi, 

 

I purchased your Product, I have problem adding JVM parmeters while making .exe

These are following paramters needs to add to JVM

-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.virtualKeyboard=javafx
-Dcom.sun.javafx.touch=true

Please help me to resolve this issue.

Thanks

Veerendra Jetty

Override arguments passed to jar

I am evaluating using jar2exe to package a client application. I would like to specify the command line parameters to be passed to javaw, rather than passing through the arguments to the exe. Is there any way to do this?

Add new comment