Comments (7)
I've started work on some additions to the invocation api in the invocation_api branch. Feel free to comment, test, PR, etc. from there and when we're all satisfied, I'll merge it to master.
from jni-rs.
Hi @jechase , we've used the tip from invocation_api branch for a while in some integration tests, and it seems to work properly. Is there anything you plan to put in it before releasing, maybe something we can help with?
from jni-rs.
This is exactly our use case, I'm really interested in this development.
At the moment we are using an adapted version of the Jvm::new
function from Rucaja to start the JVM, then we switch to jni-rs
with JNIEnv::from_raw
. It works fine for us. The only missing part in jni-rs
is the link to the dynamic library, so we had to:
- add
links = "jvm"
andbuild = "build.rs"
to ourCargo.toml
- add a
#[link(name = "jvm")] extern "C" {}
somewhere (e.g.lib.rs
) - write a
build.rs
that configures the dynamic library location (an example is here, with a related issue)
In general, I think it can be very useful to have a look at Rucaja, because it already implements the "call JVM from Rust" part. A merge of the two would be great, because most of the functionalities (call a method, call a static method, ...) are duplicated.
from jni-rs.
OK, let me see if I have this straight, since I haven't looked at the invocation api at all since it's not part of our use case.
- You want to start a JVM from rust and
- That requires linking to a the JVM dynamic library
If implemented, it's probably something that we'll want to put behind a cargo feature, since unconditionally requiring linkage to the jvm lib might be undesirable. Otherwise, sounds like a great thing to have, and would make #61 actually doable.
from jni-rs.
Hey, sorry, been out for the holidays. I don't think there was anything else that I was planning to add to it. If everything's been good with it so far, I'll go ahead and merge it :)
from jni-rs.
@fpoli , thank you a lot for the references, we'll definitely look at Rucaja closer to see how to make things work together!
from jni-rs.
Works like a charm, thank you a lot!
from jni-rs.
Related Issues (20)
- What does the correct class descriptor format looks like for `find_class`? HOT 2
- Implement `std::iter::Iter` on arrays? HOT 1
- Create a replacement for `ndk-context` just for sharing a `JavaVM` pointer between modular / orthogonal crates HOT 1
- Is it safe to have multiple versions of the `jni` crate in use within a single application? HOT 1
- Cross compiling for Android HOT 14
- Add Android target[s] to CI
- JNIEnv::get_object_array_element requires &mut self HOT 2
- Example request: `call_method` with non-primitive type as parameters. HOT 4
- TryFrom<char> for `char` primitive HOT 7
- 0.21 mutability requirements on `JNIEnv` methods break use of `catch_unwind` HOT 15
- Nested "critical sections" disallowed by borrow checker HOT 1
- Provide ways to use `CallNonvirtual*Method` in `JNIEnv` HOT 1
- Converting between types in JNI code HOT 2
- `AttachGuard` detaches too soon when dropped out of order HOT 2
- how to use call_static_method_unchecked with a GlobalRef to a class? HOT 2
- how to get java list on rust HOT 1
- CallNonvirtual<type>Method support request HOT 2
- Can i load native function on exec self ? HOT 3
- Question: How I use `GetObjectRefType` HOT 4
- Make methods `const fn` when it makes sense HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jni-rs.