Is it possible to use JNI (Java Native Interface) in Applets, has anyone has tried?
You can use JNI from an applet, just remember that the applet is running on the client so JNI will be accessing the client for the "NI" part.
I'm not quite good in JNI but I googled link which can help you. It contains info about accessing DLL with JNI. Take a look:
Calling a DLL from an Applet via JNI
Related
I searched for almost 2 hours for any example with complete code, but could not find anything that works. The issue is this: I have a C++ COM DLL that can comunicate with old MSJava, and I need to replace the MSJava with Sun/Oracle Java. Since the MSJava does not use JNI, the DLL is not JNI prepared. I plan to make another C++ DLL that implements JNI and from this call the old DLL. It's doable? Any advices? Examples? Thanks everyone. (If this is a duplicate please send me the link from the article)
I need to reference a C++ dll from my Java project. The method that I need to expose is actually written in Visual Basic. Is there any way to access the Visual Basic code in C++, so that it can eventually be accessed in the Java project?
You can use OS native DLLs from your Java project using Java Native Interface (JNI):
jmac posted the original question on my behalf. I needed to find a way to call VB DLL function from a C++ DLL.
I've given up on the VB DLL and opted for a C# DLL. The following link provides a downloadable Visual Studio solution that provides a project called DLLExporter that exports C# functions thus making them available to C++. The VS solution was written in a version earlier than 2010 but the VS 2010 migrator had no problem importing it.
http://www.codeproject.com/KB/dotnet/DllExporter.aspx
It solved my problem.
For the record, I tried to wrap my VB DLL inside the C# DLL but it didn't work. So I just migrated my VB code to C#.
Assuming this is VB 6.0 and not VB.NET, you need to create an MFC DLL wrapper for your VB ActiveX DLL.
Here's more information on Exporting VB DLL Functions.
You have to use JNI (Java Native Interface) technology.
I highly recommend the Java JNI Tutorial.
as per Andriy Sholokh ,u need to use JNI to communicate with c or c++ from your java project. You have to use native method inside your java code. hope it will help you.
Is there a java api similar to RAPI? I want to be able to access files on the windows mobile device using a java desktop program.
Thanks.
You could use RAPI itself, and access it from Java using JNI or a wrapper like Swig
We were also looking for a similar API in Java but unfortunately none is available. I wrote my own RAPI wrapper using JNI and used that in my program.
The main problem with JNI is that any un-handled exceptions/faults cause the calling Java program to shutdown as well. Do keep that in mind when writing your wrapper. There are different approaches to safe guard these, the simplest and common approach is to write a standalone program written in .Net/C++ that communicates with the RAPI and your Java program communicates with that program using pipes/files etc. this way you also don't have to write a JNI wrapper :-)
I'm trying to make a program like AutoHotKey, but with a graphical interface.
I'm using java.awt.Robot
Now I want to make the code for checking the state from a key (In AHK: getKeyState)
Of course somthing like a KeyListener without having focus.
I read already something with JNI and C++, but....
I can't find some information.
Can somebody help me??
There are lot of good JNI resources for starting out with JNI Programming like the Sun JNI Tutorial. Almost all Tutorials assume a good knowledge of C/C++ because the Java Native Interface (JNI) is the bridge between native C/C++ code, the Java Virtual Machine and everything running in there (meaning your Java Bytecode).
What you may want to do first is to find a key capturing library for your operating system of choice (you didn't mention anything specific here) in C++ and try that out as well as checking if there are already some Java bindings (libraries that use JNI and offer Java classes) to interact with. I didn't find any promising on a quick search unfortunately.
works perfect for windows 32/64 Bit. It's not necessary to integrate the dll files into the (eclipse)workspace / deployment process. Amazing Lib:
Hot stuff!
http://ksquared.de/blog/2011/07/java-global-system-hook/
I am trying to control some LEDs wired to the parallel port on Windows XP. The easiest solution would be Inpout32.dll from Logix4u.net. I have found many source code samples in various languages (C++, Visual Basic, C#) but nothing using Java.
Do you know any tutorials about calling DLL functions from Java ? (what I have found so far on Google are not so advanced).
Environment: Java 1.6.0, Windows XP
The generic way to access native code from Java is JNI.
However, there are frameworks like JNA and/or JInvoke hiding all complexity of JNI and providing interface similar to VBasic and C#.
BTW, there are JNI library and samples for your specific DLL here
There is also JNIWrapper