Skip to content

Commit d493550

Browse files
committed
In macos, we invoke /usr/libexec/java_home which returns the correct java home, without the bin/java suffix
1 parent d9bc51f commit d493550

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,11 @@ fn do_locate_java_home() -> errors::Result<String> {
222222
};
223223
}
224224

225-
// Here we should have found ourselves in a directory like /usr/lib/jvm/java-8-oracle/jre/bin/java
226-
test_path.pop();
227-
test_path.pop();
225+
if !is_macos() {
226+
// Here we should have found ourselves in a directory like /usr/lib/jvm/java-8-oracle/jre/bin/java
227+
test_path.pop();
228+
test_path.pop();
229+
}
228230

229231
match test_path.to_str() {
230232
Some(s) => Ok(String::from(s)),

0 commit comments

Comments
 (0)