Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ wine C:\\Program\ Files\ \(x86\)\\Inno\ Setup\ 6\\ISCC.exe $1
### `--type zip`

Mainly for debugging purposes, although can be used to bundle an RCP application
with local runtime. As the IDE launcher does not yet support relative JDK location,
this is less useful there.
with local runtime. When a runtime is bundled, the JDK location is written into
`netbeans.conf` relative to the installation using the launcher's `${BASEDIR}`
token, so it is found however the application is launched.

## Building from source

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,16 @@ private void copyRuntimeFromDirectory(Path runtime, Path destDir) throws IOExcep

private void addRuntimeToConf(Path conf, String jdkhome) throws IOException {
var contents = Files.readString(conf);
contents = contents.replace("#jdkhome=\"/path/to/jdk\"", "jdkhome=\"" + jdkhome + "\"");
// @TODO - fix this when relative links work with IDE launcher
// contents = contents.replace("#netbeans_jdkhome=\"/path/to/jdk\"", "netbeans_jdkhome=\"" + jdkhome + "\"");
// Point at the bundled JDK relative to the installation using the
// launcher's ${BASEDIR} token. Unlike passing --jdkhome via a shortcut,
// this resolves however the application is launched - eg. directly or
// via "Open With..." on a file. Forward slashes are tolerated on all
// platforms including Windows.
String basedirHome = "${BASEDIR}/" + jdkhome.replace('\\', '/');
contents = contents.replace("#jdkhome=\"/path/to/jdk\"",
"jdkhome=\"" + basedirHome + "\"");
contents = contents.replace("#netbeans_jdkhome=\"/path/to/jdk\"",
"netbeans_jdkhome=\"" + basedirHome + "\"");
Files.writeString(conf, contents);
}

Expand Down
4 changes: 3 additions & 1 deletion src/test/java/org/apache/netbeans/nbpackage/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public static Path buildFakeApp(Path parent, String dirname, String branding)
Files.createFile(appBin.resolve(branding));
Files.createFile(appBin.resolve(branding + ".exe"));
Files.createFile(appBin.resolve(branding + "64.exe"));
Files.createFile(appEtc.resolve(branding + ".conf"));
Files.writeString(appEtc.resolve(branding + ".conf"),
"#jdkhome=\"/path/to/jdk\"\n"
+ "#netbeans_jdkhome=\"/path/to/jdk\"\n");
Files.createFile(platform.resolve("module"));
return dir;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public void testImageWithX86_64Runtime() throws Exception {
assertTrue(Files.exists(resolve(image, "app", "bin", "app64.exe")));
assertTrue(Files.exists(resolve(image, "app", "etc", "app.ico")));
assertTrue(Files.exists(resolve(image, "app", "jdk", "bin", "java.exe")));
// bundled JDK is referenced in netbeans.conf relative to ${BASEDIR}, so
// it is found however the launcher is started (not just via a shortcut)
String conf = Files.readString(resolve(image, "app", "etc", "app.conf"));
assertTrue(conf.contains("jdkhome=\"${BASEDIR}/jdk\""));
assertTrue(conf.contains("netbeans_jdkhome=\"${BASEDIR}/jdk\""));
}

}
Loading