How to repackage Java dependent applications as MSIX

Written by Horatiu Vladasel · April 27th, 2023

#MSIX #JAVA #REPACKAGER

Java is an essential component within enterprise environments, powering various business-critical applications that are necessary for daily operations. However, it is also the most targeted platform for malware and cyber-attacks, posing a significant security risk to organizations that rely on it.

This risk is even higher if Java is not up-to-date. Companies may neglect to test their applications dependent on Java against the latest released version or continue to use a specific legacy version of Java.

Therefore, it is imperative for organizations to take proactive measures to mitigate this risk.

For organizations that adopted App-V as their preferred delivery method, a great solution is to sequence Java as a single package together with the main application (or browser shortcut) or separately and then link them. This way, the application can use the Java version within the App-V container, while the natively installed Java version can be constantly updated or removed entirely.

The main challenge with the App-V solution was to get the application (or browser shortcut) to load the correct version of Java—the Java version within the App-V container.

Now that App-V is in extended support and being replaced by MSIX, the first question that comes to mind is – will that work with MSIX? The answer is yes, and we'll show you how.

How to Repackage Java as MSIX

  1. First, download the latest Java version (available here).
  2. Once downloaded, we used the Advanced Installer Repackager to capture the application's resources.
  3. Then, take out all the unrelated files and registries that were captured during the repackaging process and build the MSIX package.

ImportantMake sure to check that the Path Environment Variable was correctly set, as it can be used by your application to load Java.

NoteAs you may be aware, MSIX does not provide native support for Environment Variables to Directory/Folder paths, and you need to inject the Package Support Framework to get around this limitation.
However, Advanced Installer comes with its own support to cover this MSIX limitation, and all you need to do is ensure that the Environment Variable you need is configured correctly in the Environment page.

Edit environment variable

For the purpose of this demo, here's how we set it up:

- We created a single line batch file to display the Java version, which was added as a file into the MSIX package.

start cmd /k "java.exe -version"

- In the Application Details page, we created an application entry pointing to the batch file created earlier.

Application Details page

And that was all.

Now, if we install our MSIX package and launch the CheckJavaVersion StartMenu entry, it displays the version of the Java that was included within the MSIX package.

Check Java Version

Moreover, if another version of Java is installed natively on the device, our application will still be able to load the correct version of Java within the MSIX container.

correct version of Java within the MSIX container

Conclusion

While Java remains a critical component in enterprise environments, it also poses a significant security risk to organizations that rely on it, particularly if it's not kept up-to-date. Many companies try to eliminate Java from their environment, but it's not always possible if they have applications that are dependent on it.

However, repackaging a Win32 application that is Java-dependent and converting it into MSIX can be a viable solution. This approach enables the application to use the Java version within the MSIX container, reducing the risk of running an outdated version of Java.

We hope you found this article helpful. If you have any related topics you would like us to cover, please let us know.

Subscribe to Our Newsletter

Sign up for free and be the first to receive the latest news, videos, exclusive How-Tos, and guides from Advanced Installer.

Comments: