Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed java home path for latest JDKs from Oracle #400

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

krzysg
Copy link
Contributor

@krzysg krzysg commented May 26, 2020

Fix of java home path reported in #398.

Tested on Linux (Java 8, 11, 14) and MacOS (Java 7, 9, 13).
Unfortunately I have no suitable Windows machine.

One thing that could be removed during merge are lines (I left it as it is since I do not understand the reason of it):

                if (new File(dir, jvmlink).exists()) {
                    jvmpath.add(dir.getAbsolutePath());
                }

I do not see any reason to search for jvmlink file since jvmlink is a (at least on MacOS and Linux) string with -ljvm which is option for linker and not file to be found.

@saudet
Copy link
Member

saudet commented May 27, 2020

Thanks! We'll need to make this work on Mac with JDK 8 too though:
https://travis-ci.org/github/bytedeco/javacpp/jobs/691390877

Yes, we sometimes need a path for the link library as well. What's the question?

@krzysg
Copy link
Contributor Author

krzysg commented May 27, 2020

Yes, we sometimes need a path for the link library as well. What's the question?

Maybe I wasn't clear enough.

Besides searching for jni.h and jni_md.h there is also search for paths where files with platform dependent names defined in jvmlink and jvmlib can be found (at least this is what code is doing).
These variables are defined as:

final String jvmlink = properties.getProperty("platform.link.prefix", "") +
                       "jvm" + properties.getProperty("platform.link.suffix", "");
final String jvmlib  = properties.getProperty("platform.library.prefix", "") +
                       "jvm" + properties.getProperty("platform.library.suffix", "");

For example jvmlib has value libjvm.dylib in MacOS or libjvm.so in Linux, so these are names of library files that can be found so in a result we have library path.

However jvmlink has value -ljvm and this is one of the compiler/linker options in command line and not file to be found anywhere, so my question is why we are searching for it?

@saudet
Copy link
Member

saudet commented May 28, 2020

However jvmlink has value -ljvm and this is one of the compiler/linker options in command line and not file to be found anywhere, so my question is why we are searching for it?

Ah, I see what you mean. That's for platforms like Windows where jvmlink ends up being "jvm.lib", which is a file, and where jvmlib is "jvm.dll", which is another file that might not be in the same directory, but in that case we're only interested in the "jvm.lib" one.

@krzysg
Copy link
Contributor Author

krzysg commented May 29, 2020

That's for platforms like Windows where jvmlink ends up being "jvm.lib"

Thanks for info, now it makes sense.

@saudet saudet merged commit 13aa059 into bytedeco:master Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants