Guide: Specifying files and classpath
Please Note: this guide assumes you have looked through:
In JWrapper you can include files, jars and folders (which will be bundled up and re-extracted during installation) into your app bundle by the use of the <File> tag in your JWrapper XML. You can use multiple file tags to include multiple files or folders.
If you want to add a file or folder which is not part of your classpath you can simply specify the file path:
<File>mydir/myfile.png</File>
<File>myOtherDir</File>
If you want to add a file which is part of your classpath you can add a classpath attribute:
<File classpath="yes" >jars/myjar.jar</File>
If you want to add a file and give it a specific path after installation relative to your app's installation folder you can specify a path attribute:
<File classpath="yes" path="mainjar.jar" >jars/myjar.jar</File>
In JWrapper you can include files, jars and folders (which will be bundled up and re-extracted during installation) into your app bundle by the use of the <File> tag in your JWrapper XML. You can use multiple file tags to include multiple files or folders.
If you want to add a file or folder which is not part of your classpath you can simply specify the file path:
<File>mydir/myfile.png</File>
<File>myOtherDir</File>
If you want to add a file which is part of your classpath you can add a classpath attribute:
<File classpath="yes" >jars/myjar.jar</File>
If you want to add a file and give it a specific path after installation relative to your app's installation folder you can specify a path attribute:
<File classpath="yes" path="mainjar.jar" >jars/myjar.jar</File>
Installing per-user, for all users, or running temporarily
JWrapper supports installing your app for use by the current user, all users, or launching as a temporary executable (and performing no install). Installing per user or for all users will create a shared config folder where you can store config files and resources which is specific to the current user or is for all users.
To choose between these you can use one of the following tags:
<InstallType>CurrentUser</InstallType>
<InstallType>AllUsers</InstallType>
<InstallType>NoInstall</InstallType>
To choose between these you can use one of the following tags:
<InstallType>CurrentUser</InstallType>
<InstallType>AllUsers</InstallType>
<InstallType>NoInstall</InstallType>
Windows Elevation
JWrapper supports launching your app as an elevated app on Windows if necessary (i.e. with admin privileges) and provides you with a number of options.
You can specify one of the following tags:
<InstallType>None</InstallType>
<InstallType>AsInvoker</InstallType>
<InstallType>HighestAvailable</InstallType>
<InstallType>RequireAdministrator</InstallType>
And you can also specify the following tag if your app needs elevated UI access:
<WindowsElevationUiAccess>true</WindowsElevationUiAccess>
You can specify one of the following tags:
<InstallType>None</InstallType>
<InstallType>AsInvoker</InstallType>
<InstallType>HighestAvailable</InstallType>
<InstallType>RequireAdministrator</InstallType>
And you can also specify the following tag if your app needs elevated UI access:
<WindowsElevationUiAccess>true</WindowsElevationUiAccess>
Skipping Platforms
If you want to skip building for one or more platforms you can use the following tags under the root tag to omit then from your build:
<SkipMacOS>true</SkipMacOS>
<SkipWindows>true</SkipWindows>
<SkipLinux>true</SkipLinux>
<SkipMacOS>true</SkipMacOS>
<SkipWindows>true</SkipWindows>
<SkipLinux>true</SkipLinux>
Forward and Backward slashes and build file portability
JWrapper will always convert any slashes in your file paths into the OS native file separator.
If you use only relative paths (e.g. using ./myfile.jar vs C:\myfile.jar) your JWrapper build XML can be used a mix of operating systems without any changes. This allows you to keep your build XML file in a versioning system like CVS or SVN without requiring OS specific changes to run.
If you use only relative paths (e.g. using ./myfile.jar vs C:\myfile.jar) your JWrapper build XML can be used a mix of operating systems without any changes. This allows you to keep your build XML file in a versioning system like CVS or SVN without requiring OS specific changes to run.
Accessing files within your app
To access any included files from within your application you can use the JW system API to retrieve your app's current version installation folder:
JWSystem.getAppFolder()
JWSystem.getAppFolder()
Excluding files from Pack200
JWrapper uses a variety of methods to reduce the size of your application very significantly. One of these methods is to use the standard Java Pack200 compression method. If you need to distribute your jars without pack200 or if pack200 is incompatible with your jars you can specify a list of exceptions using the tag <Pack200Exceptions>.
If you do not specify a specific relative path for your jar then you can simply add the name of your jar to exclude it:
<File classpath="yes">myjar.jar</File>
...
<Pack200Exceptions>
<Filename>myjar.jar</Filename>
</Pack200Exceptions>
If you do specify a relative path for your jar then you can either use the name or the full relative path:
<File classpath="yes" path="newdir/mainjar.jar">myjar.jar</File>
...
<Pack200Exceptions>
<Filename>newdir/mainjar.jar</Filename>
</Pack200Exceptions>
If you do not specify a specific relative path for your jar then you can simply add the name of your jar to exclude it:
<File classpath="yes">myjar.jar</File>
...
<Pack200Exceptions>
<Filename>myjar.jar</Filename>
</Pack200Exceptions>
If you do specify a relative path for your jar then you can either use the name or the full relative path:
<File classpath="yes" path="newdir/mainjar.jar">myjar.jar</File>
...
<Pack200Exceptions>
<Filename>newdir/mainjar.jar</Filename>
</Pack200Exceptions>
Too large classpaths
If you have a very large number of jars on your classpath then you may find some platforms fail to run because the command to launch your app is too long.
In this case you can have JWrapper merge some of your jars into one by adding merge="yes" to your File attribute. All of the marked jars will be merged into one jwmerged.jar file and added to the classpath. It is still possible to use JWCrypt with JAR merging.
<File classpath="yes" merge="yes" >myjar.jar</File>
In this case you can have JWrapper merge some of your jars into one by adding merge="yes" to your File attribute. All of the marked jars will be merged into one jwmerged.jar file and added to the classpath. It is still possible to use JWCrypt with JAR merging.
<File classpath="yes" merge="yes" >myjar.jar</File>