Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
macos: look for libjli in both lib and lib/jli
Browse files Browse the repository at this point in the history
On jdk 17, it is just in lib
  • Loading branch information
Adam- committed Sep 11, 2021
1 parent cf9cdf9 commit 1e9a7fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/native/packr/src/macos/packr_macos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,22 @@ int main(int argc, char** argv) {
bool loadJNIFunctions(GetDefaultJavaVMInitArgs* getDefaultJavaVMInitArgs, CreateJavaVM* createJavaVM) {

char buf[MAXPATHLEN];
string path;
string cwd;

if (getcwd(buf, sizeof(buf))) {
path.append(buf).append("/");
cwd.append(buf).append("/");
}

path.append("jre/lib/jli/libjli.dylib");
string path = cwd + "jre/lib/libjli.dylib";

void* handle = dlopen(path.c_str(), RTLD_LAZY);
if (handle == NULL) {
cerr << dlerror() << endl;
return false;
path = cwd + "jre/lib/jli/libjli.dylib";
handle = dlopen(path.c_str(), RTLD_LAZY);
if (handle == NULL) {
cerr << dlerror() << endl;
return false;
}
}

*getDefaultJavaVMInitArgs = (GetDefaultJavaVMInitArgs) dlsym(handle, "JNI_GetDefaultJavaVMInitArgs");
Expand Down
Binary file modified src/main/resources/packr-mac
Binary file not shown.

0 comments on commit 1e9a7fe

Please sign in to comment.