Skip to content

Commit 5f086f8

Browse files
committed
Add option for newer JavaVersion to find libjli
1 parent 4aad553 commit 5f086f8

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

native/main.m

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
#define JVM_RUNTIME "$JVM_RUNTIME"
5656

5757
#define JAVA_RUNTIME "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
58-
#define LIBJLI_DY_LIB "lib/jli/libjli.dylib"
58+
#define LIBJLI_DY_LIB_11 "lib/jli/libjli.dylib"
59+
#define LIBJLI_DY_LIB "lib/libjli.dylib"
5960
#define DEPLOY_LIB "lib/deploy.jar"
6061

6162
//*
@@ -233,7 +234,11 @@ int launch(char *commandName, int progargc, char *progargv[]) {
233234
javaDylib = [runtimePath stringByAppendingPathComponent:@LIBJLI_DY_LIB];
234235
javaDylibFileExists = [fm fileExistsAtPath:javaDylib isDirectory:&isDir];
235236
if (!javaDylibFileExists || isDir) {
236-
javaDylib = NULL;
237+
javaDylib = [runtimePath stringByAppendingPathComponent:@LIBJLI_DY_LIB_11];
238+
javaDylibFileExists = [fm fileExistsAtPath:javaDylib isDirectory:&isDir];
239+
if (!javaDylibFileExists || isDir) {
240+
javaDylib = NULL;
241+
}
237242
}
238243

239244
if (isDebugging) {
@@ -244,6 +249,14 @@ int launch(char *commandName, int progargc, char *progargv[]) {
244249
// Search for the runtimePath, then make it a libjli.dylib path.
245250
runtimePath = findJavaDylib (jvmRequired, jrePreferred, jdkPreferred, isDebugging, exactVersionMatch);
246251
javaDylib = [runtimePath stringByAppendingPathComponent:@LIBJLI_DY_LIB];
252+
253+
NSFileManager *fm = [[NSFileManager alloc] init];
254+
255+
BOOL isDir;
256+
BOOL javaDylibFileExists = [fm fileExistsAtPath:javaDylib isDirectory:&isDir];
257+
if (!javaDylibFileExists || isDir) {
258+
javaDylib = [runtimePath stringByAppendingPathComponent:@LIBJLI_DY_LIB_11];
259+
}
247260

248261
if (isDebugging) {
249262
DLog(@"Java Runtime Dylib Path: '%@'", convertRelativeFilePath(javaDylib));

0 commit comments

Comments
 (0)