Skip to content

Commit 35522c3

Browse files
author
grzegok
committed
#127 Added multiple bundled JRE path search.
1 parent 6154956 commit 35522c3

File tree

9 files changed

+39
-33
lines changed

9 files changed

+39
-33
lines changed

head/head.o

62 Bytes
Binary file not shown.

head_src/head.c

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Launch4j (http://launch4j.sourceforge.net/)
33
Cross-platform Java application wrapper for creating Windows native executables.
44
5-
Copyright (c) 2004, 2015 Grzegorz Kowal,
5+
Copyright (c) 2004, 2019 Grzegorz Kowal,
66
Ian Roberts (jdk preference patch)
77
Sylvain Mina (single instance patch)
88
@@ -914,7 +914,7 @@ void setWorkingDirectory(const char *exePath, const int pathLen)
914914
BOOL bundledJreSearch(const char *exePath, const int pathLen)
915915
{
916916
debugAll("bundledJreSearch()\n");
917-
char tmpPath[_MAX_PATH] = {0};
917+
char jrePathSpec[_MAX_PATH] = {0};
918918
BOOL is64BitJre = loadBool(BUNDLED_JRE_64_BIT);
919919

920920
if (!wow64 && is64BitJre)
@@ -923,30 +923,36 @@ BOOL bundledJreSearch(const char *exePath, const int pathLen)
923923
return FALSE;
924924
}
925925

926-
if (loadString(JRE_PATH, tmpPath))
926+
if (loadString(JRE_PATH, jrePathSpec))
927927
{
928928
char jrePath[MAX_ARGS] = {0};
929-
expandVars(jrePath, tmpPath, exePath, pathLen);
930-
debug("Bundled JRE:\t%s\n", jrePath);
931-
932-
if (jrePath[0] == '\\' || jrePath[1] == ':')
933-
{
934-
// Absolute
935-
strcpy(launcher.cmd, jrePath);
936-
}
937-
else
938-
{
939-
// Relative
940-
strncpy(launcher.cmd, exePath, pathLen);
941-
appendPath(launcher.cmd, jrePath);
942-
}
943-
944-
if (isLauncherPathValid(launcher.cmd))
945-
{
946-
search.foundJava = is64BitJre ? FOUND_BUNDLED | KEY_WOW64_64KEY : FOUND_BUNDLED;
947-
strcpy(search.foundJavaHome, launcher.cmd);
948-
return TRUE;
949-
}
929+
expandVars(jrePath, jrePathSpec, exePath, pathLen);
930+
debug("Bundled JRE(s):\t%s\n", jrePath);
931+
char* path = strtok(jrePath, ";");
932+
933+
while (path != NULL)
934+
{
935+
if (*path == '\\' || (*path != '\0' && *(path + 1) == ':'))
936+
{
937+
// Absolute
938+
strcpy(launcher.cmd, path);
939+
}
940+
else
941+
{
942+
// Relative
943+
strncpy(launcher.cmd, exePath, pathLen);
944+
appendPath(launcher.cmd, path);
945+
}
946+
947+
if (isLauncherPathValid(launcher.cmd))
948+
{
949+
search.foundJava = is64BitJre ? FOUND_BUNDLED | KEY_WOW64_64KEY : FOUND_BUNDLED;
950+
strcpy(search.foundJavaHome, launcher.cmd);
951+
return TRUE;
952+
}
953+
954+
path = strtok(NULL, ";");
955+
}
950956
}
951957

952958
return FALSE;

head_src/head.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#include <process.h>
5555

5656
#define LAUNCH4j "Launch4j"
57-
#define VERSION "3.12"
57+
#define VERSION "3.13"
5858

5959
#define JRE_VER_MAX_DIGITS_PER_PART 3
6060

l4j/nsis/launch4j-setup-license.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Launch4j :: Cross-platform Java application wrapper
22
for creating Windows native executables
33

4-
Copyright (c) 2004, 2018 Grzegorz Kowal
4+
Copyright (c) 2004, 2019 Grzegorz Kowal
55
All rights reserved.
66

77
Redistribution and use in source and binary forms, with or without modification,

l4j/nsis/launch4j.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
; HM NIS Edit Wizard helper defines
44
!define PRODUCT_NAME "Launch4j"
5-
!define PRODUCT_VERSION "3.12"
5+
!define PRODUCT_VERSION "3.13"
66
!define PRODUCT_PUBLISHER "Grzegorz Kowal"
77
!define PRODUCT_WEB_SITE "http://launch4j.sourceforge.net"
88
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\launch4j.exe"

src/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Launch4j (http://launch4j.sourceforge.net/)
22
Cross-platform Java application wrapper for creating Windows native executables.
33

4-
Copyright (c) 2004, 2017 Grzegorz Kowal
4+
Copyright (c) 2004, 2019 Grzegorz Kowal
55
All rights reserved.
66

77
Redistribution and use in source and binary forms, with or without modification,

src/launch4j.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
versionNumber=3.12.0.0
2-
version=3.12
1+
versionNumber=3.13.0.0
2+
version=3.13

src/net/sf/launch4j/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private static void setDescription(Properties props) {
8686
" (http://launch4j.sourceforge.net/)\n" +
8787
"Cross-platform Java application wrapper" +
8888
" for creating Windows native executables.\n\n" +
89-
"Copyright (C) 2004, 2018 Grzegorz Kowal\n\n" +
89+
"Copyright (C) 2004, 2019 Grzegorz Kowal\n\n" +
9090
"Launch4j comes with ABSOLUTELY NO WARRANTY.\n" +
9191
"This is free software, licensed under the BSD License.\n" +
9292
"This product includes software developed by the Apache Software Foundation" +

src/net/sf/launch4j/form/messages.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ mutexNameTip=Mutex name that will uniquely identify your application.
8888
windowTitle=Window title
8989
windowTitleTip=Title of the GUI application window to bring up on attempt to start a next instance.
9090

91-
jrePath=Bundled JRE path:
92-
jrePathTip=Bundled JRE path relative to the executable or absolute.
91+
jrePath=Bundled JRE paths:
92+
jrePathTip=Bundled JRE path(s) relative to the executable or absolute, for example 'myAppJre' or 'c:\\GlobalJre;%JAVA_HOME%'.
9393
bundledJre64Bit=64-bit
9494
bundledJre64BitTip=The bundled JRE is 64-bit, heap size will not be limited to the 32-bit maximum.
9595
bundledJreAsFallback=Fallback option

0 commit comments

Comments
 (0)