Orangevolt ANT Tasks | ||
Complete HotKey Code Reference | References |
Version 1.2 of Orangevolt Ant Tasks extends the commandine parameters of jstub and sfx task. You can add placeholders for enviroment and registry settings to the commandline which are evaluated and replaced at runtime.
Suppose your application setup installs a private java runtime and the path to it
is stored in the windows registry. Your application does not know about the location of
the private java runtime.
By using the registry/enviroment features of sfx and jstub you are able to
retrieve registry/enviroment informations at executable runtime.
The following example commandline will query the registry and replace the ant tokens
by the queries value:
class com.orangevolt.sourcestyle.xalan.Extension : error : mode bat is unknown. |
The commandline(s) patched into executables created with jstub and sfx are parsed for ant styled variable placeholders containing
Registry(reg), enviroment(env) or application(app).
reg queries windows registry entries.
env queries a environment variable.
app queries parts of the executable file name/path.
The app type is especially useful when you need to know where your executable resides.
For example
${app:path}returns the directory where your executable resides. The jstub created executable can contain the following executable string
javaw -Djava.ext.dirs="${app:path}" -jar ${app:absolutepath}which is at runtime replaced by path (${app:path}) an path+absolutename (${app:absolutepath}) of your executable.
In case of an enviroment setting use the name of the enviroment variable (${env:TEMP} or ${env:TOMCAT_HOME} for example).
When accessing the registry
The default value will be returned in case that the requested enviroment variable or registry key was not found.
Placeholders in general are defined using the following syntax:
${type:name(|default)*}
type is either reg (for registry), env (for enviroment) or app (for application).
The name of the value to query.
In case of a queried enviroment variable simply use the name of the variable.
When querying an registry key you have to use the following sub syntax
for the name key\subkey
.
The key is the name of the registry part to query. Valid values are
The subkey identifies the registry branch to query.
The following variable definition queries the window desktop location
${reg:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Desktop}
.
This example queries location of an installed jdk 1.4.2 and returns c:\java if it is not set
${reg:HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.4.2|c:\java}
.
When querying the app type the following predefined names can be used:
name is the file name of the executable WITHOUT file suffix. The name of a executable named "test.exe" is "test".
absolutename is the real file name of the executable. The absolutename of a executable named "test.exe" is "test.exe".
path is the directory where the executable resides. The path of a executable located in "c:\temp" is "c:\temp".
absolutepath is the name of the executable including its full path. The absolutepath of a executable "test.exe" located in "c:\temp" is "c:\temp\test.exe".
This value will be used if the enviroment variable or registry value was not found.
default is ignored for type app.