Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-16-2003, 03:08 PM   #1
renato soffiatt
LQ Newbie
Registered: Oct 2003
Posts: 1

Rep: Reputation: 0
Question What is the best way to call a Java program from a C prog in Linux?

I have a C program running in a Linux and I need to call a Java program (use a Java Interface).

Someone told me to use the system call EXEC to call the java program. But how to use it passing all the necessary parameters and also receiving the result of the operation?

Is there a way to create something like a proxy in C for a Java Interface, so that I can use the java object as it was "inside" my C program?

I am not familiar with Linux yet. I would apreciate any help.
If it possible, please, give code examples!

Very thanks
Old 10-17-2003, 07:06 AM   #2
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840

Rep: Reputation: 32
One approach is to use

"system (java filename)"

and then using stdin & stdout to comm. between the two apps. I have done this and it is good. This method is also found in "Thinking in java" from


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
call mail program like blat from java to send attachments naijaguy Linux - Software 1 05-04-2008 09:09 PM
how to write a simple c prog to call a script RajRed Programming 1 10-05-2005 05:10 PM
how to write a simple c prog to call a script RajRed Linux - Software 1 10-05-2005 02:57 PM
Urgent: Call a C program through Linux shell script nuwandee Programming 14 04-10-2004 07:31 PM
How to call the arp linux shell command from within a perl program Bassam Programming 1 03-11-2004 02:00 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:00 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration