Coder Social home page Coder Social logo

Compiling on Windows about jni-rs HOT 5 CLOSED

jni-rs avatar jni-rs commented on May 28, 2024
Compiling on Windows

from jni-rs.

Comments (5)

fasihrana avatar fasihrana commented on May 28, 2024 1

OK, I reinstalled Rust from its offline installer. After that the program was correctly complaining about jvm.dll not found. Then it complained about not finding jvm.lib when linking. That was fixed by adding a build.rs file with just the following:

fn main(){
        if cfg!(target_os = "windows") {
                println!(r"cargo:rustc-link-search=c:\Path\to\jdk\lib\");
        }
}

So, now I'm getting errors when I execute the binary compiled complaining that the jvm.dll could not be found even though the directory is in Path.

from jni-rs.

fasihrana avatar fasihrana commented on May 28, 2024 1

The reason is that in Powershell "set PATH" doesn't really have any effect.

Had to export the path as $env:Path = $env:Path + "\path\to\jvm.dll"

from jni-rs.

fpoli avatar fpoli commented on May 28, 2024

The error message is wrong: on windows it looks for jvm.dll (see here).

Have you set JAVA_HOME? Do you have jvm.dll somewhere in it?

The build script looks for jvm.dll in all the subdirectories of the path specified in the JAVA_HOME environment variable.

from jni-rs.

alexander-irbis avatar alexander-irbis commented on May 28, 2024

You should add a directory with jvm.dll into the PATH environment variable.

from jni-rs.

fasihrana avatar fasihrana commented on May 28, 2024

I have specified JAVA_HOME and the jvm.dll is in %JAVA_HOME%\jre\bin\server.

from jni-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.