Skip to content

Commit

Permalink
fix(jawt): add java.home fallback
Browse files Browse the repository at this point in the history
This is useful when the default java.library.path does not include the
JRE bin directory (e.g. when the JVM is launched via the JDK's java
executable).
  • Loading branch information
Spasi committed Nov 28, 2017
1 parent e07531e commit d20409b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions modules/core/src/main/java/org/lwjgl/system/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,15 @@ public static SharedLibrary loadNative(Class<?> context, String name) {
public static SharedLibrary loadNative(Class<?> context, String name, boolean bundledWithLWJGL) {
apiLog("Loading library: " + name);

String libName = Platform.get().mapLibraryName(name);

// METHOD 1: absolute path
if (new File(name).isAbsolute()) {
SharedLibrary lib = apiCreateLibrary(name);
if (new File(libName).isAbsolute()) {
SharedLibrary lib = apiCreateLibrary(libName);
apiLog("\tSuccess");
return lib;
}

String libName = Platform.get().mapLibraryName(name);
SharedLibrary lib;

// METHOD 2: org.lwjgl.librarypath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.lwjgl.system.jni.*

val jawt = "JAWTFunctions".nativeClass(JAWT_PACKAGE, prefix = "JAWT_", prefixMethod = "JAWT_", binding = simpleBinding(
"jawt",
libraryExpression = """Configuration.JAWT_LIBRARY_NAME.get("jawt")""",
libraryExpression = """Configuration.JAWT_LIBRARY_NAME, "jawt", System.getProperty("java.home") + "/bin/jawt"""",
callingConvention = CallingConvention.STDCALL
)) {
nativeDirective(
Expand Down

0 comments on commit d20409b

Please sign in to comment.