equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
664 */ |
664 */ |
665 static jboolean |
665 static jboolean |
666 GetJREPath(char *path, jint pathsize, const char * arch, jboolean speculative) |
666 GetJREPath(char *path, jint pathsize, const char * arch, jboolean speculative) |
667 { |
667 { |
668 char libjava[MAXPATHLEN]; |
668 char libjava[MAXPATHLEN]; |
|
669 struct stat s; |
669 |
670 |
670 if (GetApplicationHome(path, pathsize)) { |
671 if (GetApplicationHome(path, pathsize)) { |
671 /* Is JRE co-located with the application? */ |
672 /* Is JRE co-located with the application? */ |
672 JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/%s/" JAVA_DLL, path, arch); |
673 JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/%s/" JAVA_DLL, path, arch); |
673 if (access(libjava, F_OK) == 0) { |
674 if (access(libjava, F_OK) == 0) { |
681 } |
682 } |
682 /* Does the app ship a private JRE in <apphome>/jre directory? */ |
683 /* Does the app ship a private JRE in <apphome>/jre directory? */ |
683 JLI_Snprintf(libjava, sizeof(libjava), "%s/jre/lib/%s/" JAVA_DLL, path, arch); |
684 JLI_Snprintf(libjava, sizeof(libjava), "%s/jre/lib/%s/" JAVA_DLL, path, arch); |
684 if (access(libjava, F_OK) == 0) { |
685 if (access(libjava, F_OK) == 0) { |
685 JLI_StrCat(path, "/jre"); |
686 JLI_StrCat(path, "/jre"); |
|
687 JLI_TraceLauncher("JRE path is %s\n", path); |
|
688 return JNI_TRUE; |
|
689 } |
|
690 } |
|
691 |
|
692 if (GetApplicationHomeFromDll(path, pathsize)) { |
|
693 JLI_Snprintf(libjava, sizeof(libjava), "%s/lib/%s/" JAVA_DLL, path, arch); |
|
694 if (stat(libjava, &s) == 0) { |
686 JLI_TraceLauncher("JRE path is %s\n", path); |
695 JLI_TraceLauncher("JRE path is %s\n", path); |
687 return JNI_TRUE; |
696 return JNI_TRUE; |
688 } |
697 } |
689 } |
698 } |
690 |
699 |