Results 1 to 9 of 9
- 09-05-2008, 04:07 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 11
- Rep Power
- 0
-
You will need to compile the C-code with the correct settings and interface it with Java using JNI. There are tutorials on this, but understand that this is not trivial programming and will take some work to get to understand.
- 09-06-2008, 02:32 PM #3
If the c code is executeable from a command prompt, then you could use the Process and Runtime classes to execute it from a java program.execute the c code
- 09-07-2008, 06:27 AM #4
Member
- Join Date
- Sep 2008
- Posts
- 11
- Rep Power
- 0
Tell me the step by step procedure
I have developed the c program on linux and I have j2se installed on my windows now I need To make a GUI wrapper to the c program, which will do good with linux and windows both... 1st help me so that i can develop the same/application on XP, tell me the step by step procedure to achieve the same.
Do I need and c compiler with java?
-
You really don't understand the magnitude of what you are asking here. Let me help you. Go to these tutorials on JNI:I have developed the c program on linux and I have j2se installed on my windows now I need To make a GUI wrapper to the c program, which will do good with linux and windows both... 1st help me so that i can develop the same/application on XP, tell me the step by step procedure to achieve the same.
CodeProject: JNI Basics - 1. Free source code and programming help
Chapter 5: JNI Technology
Java Native Interface: Programmer's Guide and Specification
Read and study them, and then come back in about a month, maybe longer.
Also, one more thing: using JNI often breaks your program's platform independence.
Lots of luck.Last edited by Fubarable; 09-07-2008 at 06:40 AM.
- 09-07-2008, 06:51 AM #6
Member
- Join Date
- Sep 2008
- Posts
- 11
- Rep Power
- 0
If that is so hard....
Sorry Fub for askin you a qn with such a big answer, if making it in java is so tough then could you suggest me a better way to have a gui wrapper for c in linux?
and tell me the same if I do it for windows?
Simplicity of the wrapping language is one of the preferences.
-
Let me correct myself. If you are a wiz at C++, then you'll probably catch on to JNI pretty quickly. Us mere mortals may take longer.
- 09-07-2008, 02:15 PM #8
How do you plan to communicate between the C program and the java program? Will the interface require more than what would go on a commandline or be printed to a std out?
- 09-11-2008, 05:09 AM #9
Member
- Join Date
- Sep 2008
- Posts
- 7
- Rep Power
- 0
Hi,
Try using swig.I cant post the link cos the the forum only allows you to post a link once you make 20 posts. But just google for Swig, you should be able to find it easily. Using Swig, it can easily convert C/C++ code into java by generating the JNI for you. Isnt that great.
I have used it to interface my C++ code with Java Swing.
Hope it helps.
Cheers
Similar Threads
-
Java Programming Tutorial
By levent in forum Java TutorialReplies: 1Last Post: 07-04-2008, 08:15 AM -
java game programming
By gammaman in forum New To JavaReplies: 1Last Post: 12-25-2007, 01:01 AM -
Java networking programming (I)
By Java Tutorial in forum Java TutorialReplies: 0Last Post: 12-24-2007, 07:21 PM -
Java Applet 3D programming
By ramk in forum Java AppletsReplies: 0Last Post: 11-28-2007, 10:36 PM -
Java Programming
By JavaForums in forum Java TutorialReplies: 0Last Post: 07-28-2007, 11:10 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks