Results 1 to 16 of 16
Thread: JNI Help
- 05-20-2010, 03:54 PM #1
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
JNI Help
I have researched about this JNI thing over the net.
I am currently developing a program to make the computer manipulate the Windows regristry. The maniplation in a way that the program can enable/disable accessing the control panel, task manager, a particular drive, etc.
I have research that c++, c#, visual basic can manipulate the windows registry but the main language of the program is Java.Every project, package, class, method, variable, syntax, algorithm, etc.
are registered in my memory bank. Thanks to this thread.
- 05-20-2010, 03:55 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
And?
Your question is?
- 05-20-2010, 04:15 PM #3
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
Is it possible that it could be possible that through JNI, we could manipulate the Windows Registry.
And how?Every project, package, class, method, variable, syntax, algorithm, etc.
are registered in my memory bank. Thanks to this thread.
- 05-20-2010, 04:32 PM #4
Yes. Java could call another program that is able to change the Registry. JNI could be the way to do it.
Another way would be to call a program using the Runtime & Process classes and pass that program instructions on the commandline.
- 05-21-2010, 03:06 AM #5
Member
- Join Date
- Dec 2008
- Posts
- 64
- Rep Power
- 0
Correct, Java does not have this level of control. I have code that does exactly this, your best bet is to do as I did and write your own custom DLL file, package it in with your application and call the methods via JNI.
- 05-21-2010, 11:42 AM #6
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
Ok. Thanks for the suggestions.
But I am having a hard time understanding how JNI really works or coded.
Can you help me to fully understand the basics of JNI programming?Every project, package, class, method, variable, syntax, algorithm, etc.
are registered in my memory bank. Thanks to this thread.
- 05-21-2010, 11:55 AM #7
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
- 05-21-2010, 11:57 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
- 05-21-2010, 01:43 PM #9
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
Whew. This tutorial is the one i'm having a hard time understanding it.
But if it's the only way around, I have to read between the lines. :)
Are there any tutorial on how to write a JNI code using IDE (Netbeans 6.8 or Eclipse 3.4.1)?Every project, package, class, method, variable, syntax, algorithm, etc.
are registered in my memory bank. Thanks to this thread.
- 06-03-2010, 06:48 AM #10
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
Is there an easier comprehensive tutorial about JNI?
I still have a hard time understand the logic of JNI.Every project, package, class, method, variable, syntax, algorithm, etc.
are registered in my memory bank. Thanks to this thread.
- 06-03-2010, 03:51 PM #11
I'm not sure there is logic for JNI. I think its mostly cookbook: Read and follow instructions.
- 06-03-2010, 04:12 PM #12
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
Ok. But can you guide me step by step on how to create a program using JNI?
Every project, package, class, method, variable, syntax, algorithm, etc.
are registered in my memory bank. Thanks to this thread.
- 06-03-2010, 05:09 PM #13
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,422
- Blog Entries
- 7
- Rep Power
- 17
-
Honestly, you're asking a heck of a lot here, and I strongly doubt that anyone really has the time to walk you hand in hand through something as complex as this. Most of us have lives/jobs/families, etc... If this is what you really need, consider paying for a tutor. Otherwise do what the rest of us did: get lots of your caffeinated beverage of choice and dedicate several days to working through the tutorials til you eventually work this thing out.
Please feel free to come back though if you have a specific question.
- 06-04-2010, 06:54 AM #15
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
I know it may seems a lot for this thread.
But I was asking the general steps on how to create a JNI program.
I am having a hard time understanding the JNI API.Every project, package, class, method, variable, syntax, algorithm, etc.
are registered in my memory bank. Thanks to this thread.
- 06-04-2010, 07:56 AM #16
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,422
- Blog Entries
- 7
- Rep Power
- 17
It's not so hard: start by writing a little class that has a 'native' method declaration. Compile the class (using javac) and run javah on your .class file (your actual class). Javah generates a .h (header) file for C or C++. It contains the prototype for that native method. You have to implement that method in a .c or .cpp (or whatever) file.
You compile that file and link it; you have to create a .so file (or .dll file). So now you have a compiled .java file: a .class file that has a reference to a native method. The compiled method is stored in your .so (or .dll) file. All you have to do is load that library with the System.loadLibrary( ... ) method and you're in business.
kind regards,
Jos


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks