Results 1 to 6 of 6
Thread: call win32 api from java
- 11-01-2010, 03:28 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 3
- Rep Power
- 0
-
This is too involved and general a question to be simply answered in the forum or solved with a code snippet. I strongly urge you to google for JNI tutorials and start studying. Then later if you get stuck at a specific step and have an answerable question, please come on back and we'll try to help you.
Much luck and welcome to the forum.
- 11-01-2010, 06:22 PM #3
Member
- Join Date
- Nov 2010
- Posts
- 3
- Rep Power
- 0
i tried this :
public class NewMain
{
static{System.load("C:\\WINDOWS\\system32\\kernel3 2.dll");}
native private static short GetSystemDefaultLangID();
public static void main(String ss[])
{
System.out.print(GetSystemDefaultLangID());
}
}
but trows an exception of java.lang.UnsatisfiedLinkError.
why?
-
Come on now get serious. You can't do JNI without first reading how to do it. Trial and error will not work here.
- 11-01-2010, 06:41 PM #5
Member
- Join Date
- Nov 2010
- Posts
- 3
- Rep Power
- 0
call win32 api from java
i have searched a lot on google but provides tutorials on creating c/c++ file and use it from java.But not found any help on calling apis from existing dll.
As you know please give me the link for that.
-
That's just it -- you don't call the link directly in your Java program. It needs to be wrapped first in a C or CPP program that conforms with JNI specifications and with the header file created by the javah program. This is all spelled out in most any JNI tutorial. You can find links to them in the Wikipedia article on JNI, but the first one to read is the Sun/Oracle tutorial: Java Native Interface: Programmer's Guide and Specification
But this too is linked to in the Wikipedia article.
Another option is JNA though and you may wish to explore this too: JNA Official SiteLast edited by Fubarable; 11-01-2010 at 10:44 PM. Reason: added link to JNA official site
Similar Threads
-
how to call Java Bean Ireport frm Java application
By Prashant.surwade in forum Advanced JavaReplies: 8Last Post: 05-06-2012, 03:39 PM -
Problem with running eclipse-jee-helios-win32-x86_64
By rohit_mali55@yahoo.in in forum EclipseReplies: 2Last Post: 09-09-2010, 03:48 PM -
call by value and call by reference in java
By sandeepsai39 in forum New To JavaReplies: 7Last Post: 08-12-2010, 11:03 AM -
JFileChooser and Native OpenFile Dialog(win32)
By paluee in forum AWT / SwingReplies: 2Last Post: 03-25-2009, 10:25 PM -
Accessing RS 232, serial (com) port on windows (win32)
By sunnyalex in forum New To JavaReplies: 1Last Post: 10-15-2008, 05:13 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks