Skip to content

Commit

Permalink
Added jar app asset support to snap
Browse files Browse the repository at this point in the history
  • Loading branch information
johnman committed Oct 30, 2024
1 parent fad4d64 commit 9565445
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions how-to/workspace-platform-starter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@
- Updated the example content creation rule to support specifying a default view placement position when window.open is called from inside a view. Defaulted it to "stack-right" so that it has the same behavior as Chrome/Edge when window.open is called without a target (opens a new tab to the right hand side of the tab). It is now turned on by default in the main manifest (search for view-position-content-creation)Turned it on by default (the example app content Content Creation Examples will now work). See [How to Customize Content Creation Rules](./docs/how-to-customize-content-creation-rules.md).
- Change - Updated the platform mapper (configurable option to make snapshots smaller when sending to custom endpoints) so that it no longer strips out snapshotDetails as we received feedback that it resulted in monitor placement not working as it should.
- Enhancement - Added support for SNAP SDK 1.0.0
- Experimental - Added support for launching a jar app asset through snap. JAVA_HOME needs to be defined as an environment variable with the following new snap 1.0.0 combined strategy:

```json
"launchPreference": {
"options": {
"type": "native",
"snap": {
"strategy": {
"type": "combined",
"timeoutMs": 60000,
"matchNameRegex": "^Java Starter*",
"multiProcess": true,
"expectedWindowCount": 50
}
}
}
}
```

## v19.0.0

Expand Down
15 changes: 15 additions & 0 deletions how-to/workspace-platform-starter/client/src/framework/snap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,21 @@ export async function launchApp(
): Promise<string | undefined> {
try {
if (server) {
if (path.endsWith(".jar") && !path.includes("java.exe") && !path.includes("javaw.exe")) {
logger.info("Launching a jar file, checking JAVA_HOME environment variable");
const javaHome = await fin.System.getEnvironmentVariable("JAVA_HOME");
if (!isEmpty(javaHome)) {
const javawExe = `${javaHome}\\bin\\javaw.exe`;
args?.unshift(path);
args?.unshift("-jar");
path = javawExe;
logger.info(`Using ${javawExe} to launch the jar file and moved the original path to the args`);
} else {
logger.warn(
"JAVA_HOME environment variable is not set, unable to update the path. Passing as is to snap to try to resolve."
);
}
}
const clientId = `${NATIVE_APP_PREFIX}/${appId}/${instanceId}`;
let launch = true;

Expand Down

0 comments on commit 9565445

Please sign in to comment.