How to package AdvancedView (with Java bundled) as MSIX

Written by Horatiu Vladasel · August 11th, 2023

Repackaging aWin32 app with Java dependencies as MSIX can often be challenging.

In our previous article we discussed How to repackage Java dependent applications as MSIX. We created a single line batch file to display the Java version, added that as a file into the MSIX package and created an application entry pointing to it.

Now it’s time to repackagea real software applicationAdvanced View. In this article we’ll go through two distinct solutions for adding Java into the MSIX container.

NoteFor this tutorial you need to download the Advanced View application and the Advanced Installer 30-day free trial.

Repackaging and Debugging Advanced View

To repackage Advanced View as an MSIX, we follow the standard process and capture the vendor installer resources.

We can notice that the vendor Win32 installer includes Java JRE and that all the Java resources are installed within the application folder.

Java JRE files installed

However, testing the converted MSIX package may lead to a runtime error.

MSIX packaging error

Using Process Monitor, you'll find that the application is trying to access Java from a different path than where the application is installed:

  • The application istrying to access Java from C:\Program Files\WindowsApps\AdvancedView 4.7.1\jre\bin
  • But our application is installed in C:\Program Files\WindowsApps\AdvancedView_4.7.1.0_x64__w3t8drnyzsjsr\jre\bin.
Process Monitor

Here are two solutions to this issue.

Using Environment Variable to Add Java Resources to MSIX Container

Quick Fix with Path Environment Variable: You can directly add the Java installation location to the Path Environment Variable as shown below.

Add Java to MSIX through Environment Variable

The Environment Variable is now visible only within the MSIX container, allowing the application to access Java resources.

NoteCheck out this article to find out How to Set Up an Environment Variable in MSIX to Directory and File Paths.

Using VFS to Add Java Resources to MSIX Container

Two important things I discovered working with Advanced View:

  • The MSIX package does not work as expected when packaged as a PVAD (primary virtual application directory);
  • But it works when all files are placed under the VFS folder.

When an application tries to find or read a file inside the VFS folder, the system automatically checks both theredirected package VFSlocation and the application's requested location.

To package your application as VFS, you need to:

  1. Open the Advanced Installer project file;
  2. Go to the Install Parameters page;
  3. Set the Application Folder to the install location of your application – e.g., [ProgramFilesFolder]AdvancedView 4.7.1.
Set Application Folder

Conclusion

Packaging AdvancedView with Java bundled as MSIX is achievable through two effective solutions.

Whether you opt for the Environment Variable method or the VFS strategy, both ensure smooth access to Java resources within the MSIX container.

We hope this guide makes it easy for IT professionals and developers to overcome these challenges in the application packaging industry.

Written by
See author's page
Horatiu Vladasel

Horatiu is a Software Packager/Sequencer with over 10 years experience, who has worked as a Software Packager at IBM and is currently offering software packaging services to companies such as BT or Nationwide.

Comments: