Results 1 to 7 of 7
- 12-24-2008, 06:56 AM #1
Member
- Join Date
- Dec 2008
- Posts
- 2
- Rep Power
- 0
How to invoke a C API using Java program
Hi
I've a C API to be called from a JAVA program. Is that possible. If yes, please explain in detail.
Detailed Info:
The C API has to be tested using a testing language called TTCN3. This uses eclipse. There's some part of code that has to be written in JAVA and hence can u please tell me how to link the output of JAVA to invoke the C API.
Thanks
Gopi
-
Yes, kind of. You'll need to read up on how to use the Java Native Interface or JNI, and then create a small C program that conforms to the JNI standards that will allow you to bridge your C API and Java. If you Google on this, you'll find several decent tutorials.
- 12-26-2008, 05:10 AM #3
Member
- Join Date
- Dec 2008
- Posts
- 2
- Rep Power
- 0
Thank you very much.....I'll take a look at JNI and then post further querries.
-
You're welcome. I hope that you're better versed in C/C++ than I am, because if not, then it'll be a tough slog (speaking from personal experience here!).
Good luck!
- 12-26-2008, 08:00 AM #5
Member
- Join Date
- Jul 2008
- Posts
- 35
- Rep Power
- 0
Or you can use J/Invoke to call any C\C++ API or function from pure Java program. I've found they have a good tutorial on this: see it- Calling DLLs from Java | J/Invoke
there is no need to use any JINI here.New to Java/PHP/Javascript development?
For free help go to- www.techcubetalk.com
- 12-27-2008, 11:00 AM #6
Member
- Join Date
- Sep 2008
- Posts
- 43
- Rep Power
- 0
Nice link Jack! wasn't sure it was that easy ;)
-
but J/Invoke is not free but in fact costs $400. While this may be worth it if you are developing a professional product, if you're doing this for school or just messing around (or even if you are creating a professional product) it's worth your while to explore JNI, since as it's part of the standard Java libraries, it is free.
Similar Threads
-
Invoke Applet
By chankokchern in forum Java AppletsReplies: 1Last Post: 07-29-2008, 04:35 PM -
How to execute an External Program through Java program
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 02:40 PM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:33 PM -
java.lang.NoClassDefFoundError Exception when I invoke to a class outside projectEJB
By Daniel in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 07-06-2007, 06:08 AM -
Re address to jsp to that I invoke it
By Marcus in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 06-09-2007, 04:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks