Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a question. Is it do able to hook into a C++ program with Java? And what do I need/make? Because I dont have any Idea how I could do it. I researched already in the internet but I didn't find something that could me help.
I'm very interested in it. ^^
~ Dragon (;
You can use the Java Native Interface.
In computing, the Java Native Interface (JNI) is a programming framework that enables Java code running in a Java Virtual Machine (JVM) to call and be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages such as C, C++ and assembly.
These links might be helpful.
Wrapping up a C++ API in Java or .NET
http://www3.ntu.edu.sg/home/ehchua/programming/java/JavaNativeInterface.html
http://thebreakfastpost.com/2012/01/21/wrapping-a-c-library-with-jni-introduction/
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'd like to make a simulation, but I'd like to write the code to display the state of the simulation and the user interaction (frontend?) in Java (Kotlin actually, but I don't think it is relevant here) for the JVM, and I'd like to write the actual code of the simulation (backend?) in Rust. Mostly because I think it would be neat and that I would learn something.
Can I achieve this, and if yes, how? It might be relevant that the data that needs to be exchanged between the two programs is just a fixed-size array of floats.
Thank you for your help.
A Rust program compiles to native code (executable or shared library). To call native code from Java you have to use JNI: https://www.baeldung.com/jni.
You may find the jni crate useful for the Rust side of the project: https://docs.rs/jni/0.16.0/jni/
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm developing an application for manage security alarms and I have to work with the alarms API, an old code written in C#. The requests for disarm, arm...the alarms have to be done in Pascal (STDCALL) and I don't know how combine Android and Pascal.
Can anyone help me?
A lot of thanks.
The only way I know to execute Pascal code in Android is to compile a Free Pascal/Delphi shared library(.so) and access its interface through JNA/JNI. Of which two JNA seems to be the far less difficult option:
https://github.com/java-native-access/jna
You can't use Android's NDK tools to build such a native library as it is only C/C++. So you need to use an external compiler.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
i want to write a program in two different languages java and c++ that needs a dynamic and interactive communication between its c++ component and java component.i know there is jni and jna for invoking native methods in java but i do not think this method is appropriate for my purpose.
for example : say a program that its User Interface is written in c++ and other in java, i do not think that communicating these two component can be done through jni and jna. for example Open Office is written in java and c++.
i searched the internet and find some method for Inter-process communication
like shared memory , pipe, signals, Message passing , ... but i don not know that Inter-process communication is what i need. it seems ipc is for communicating software in two different process but my program all is one process(am i right?!)
so my question is : how the programs that its component is written in different language communicate together? and how i can achieve this?
JNI has been exactly created for the purpose that you are describing; why exactly is it not "what you need"?
One other option: message brokers with implementations for different languages, like http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol
But as you are stressing the latency, this might not be for your.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a dll C# Libraries and want to use it through my android app, I managed to run it through java but it didn't work through android, the way I used and the Exception raised is described here, but I found through searching that this way won't work with android, also I found a lot of questions about that issue but didn't got any suitable answer (e.g here, here, ...etc), So, I just want a clear answer, can I or can't? and if I can using any work around, How ?
Dynamic-link library (also written unhyphenated), or DLL, is Microsoft's implementation of the shared library concept in the Microsoft Windows
Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google.
So no, you cant. Teoretically in some kind of VM, still - no.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am looking for the right "Hook" on Mac OS X, Linux and Windows to detect when a folder and/or file gets updated.
I am using JAVA and Object-C for the MAC.
Thanks in advance.
Also if you have any tips to go on doing this, will be truly appreciated.
Thanks in advance.
On Linux you should look at inotify
I'm not aware of any Java library that does this stuff - especially not cross platform.
On Windows the Win32 API offers such functionality though with the ReadDirectoryChanges or FindFirstChangeNotification function.
Writing a small c wrapper that's called per JNI seems not too hard - the problem is probably finding out how to implement the basic featureset that can be supported by all three platforms.