Open ErichDonGubler opened 6 years ago
Thanks for taking an interest. You're right, this project isn't a huge priority for me. I unfortunately don't have a Windows box to experiment on at the moment.
For some reason, macOS requires a legacy version of Java (Java 6) in order for the JNI to work. Maybe you could try downloading the equivalent for Windows? Other than that, I'm out of ideas really. Sorry.
macOS requires a legacy version of Java (Java 6) in order for the JNI to work.
pretty sure that's not right, I recently (last job) built a java application for mac with jni components using java 8 (built the app using javafx though, which does a bunch of weird stuff)
Yeah all the API calls that RJNI uses are documented in the Java 8 JNI documentation. So I'm sure there's a way to get the project working with Java 8, but for some reason every time I try and use RJNI macOS asks me to download a legacy Java version. Probably something to do with how I'm building the .class
files and instantiating the JVM.
definitely to do with how you're instantiating the jvm, if you double click a .class
file or some equivalent mac pops up that stupid message
I think the first way I got it to work outside Intellij was to build an app with platypus since apple doesn't like for any java thing to be the primary target of a .app
this stack overflow post gets it to build (if you make sure you have the right target for your machine) and adding the location of jvm.dll to PATH gets it to run (usually jre/bin/server)
so I inserted this into my cargo config (%USERPROFILE%/.cargo/config)
[target.x86_64-pc-windows-msvc.jvm]
rustc-link-lib = ["jvm"]
rustc-link-search = ["C:/Program Files/Java/jdk1.8.0_161/lib"]
root = "C:/Program Files/Java/jdk1.8.0_161/lib"
changed the Cargo.toml to this
[package]
name = "rjni"
version = "0.0.1"
authors = ["Ben Anderson <gravityscore@gmail.com>"]
links = "jvm"
build = "src/build.rs"
[dependencies]
libc = "*"
added C:\Program Files\Java\jre1.8.0_161\bin\server
to my PATH env variable, and now it runs on my windows machine, you'll probably need to change some of those paths
It's unclear how to build from source at the moment. Attempting to build from a Windows 10 box for the stable MSVC target with no attempt at special configuration yields:
I understand that this project is a work-in-progress, and this may not be an immediate priority for you. However, adding documentation like this will enable people to experiment and contribute, if it's something you think might help this project along. :)