Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-10-2007, 07:31 AM
Member
 
Join Date: Jul 2007
Posts: 6
rach is on a distinguished road
urgent:calling c program from java
hii
i have a c program (unix)...which is to find process info..
now i want to call that from java ...
wat do i do?


please help
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-10-2007, 11:03 AM
Member
 
Join Date: Aug 2007
Posts: 47
henry_78 is on a distinguished road
Hi,
what do u mean by colling it..?
U want only to run the C application or u want it to be interactve with your java program?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-13-2007, 09:56 AM
Member
 
Join Date: Jul 2007
Posts: 6
rach is on a distinguished road
i want to run the c program form the java program
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-13-2007, 01:33 PM
Member
 
Join Date: Aug 2007
Posts: 47
henry_78 is on a distinguished road
There are many ways,
U can open a console from java and execute a comand tha runs the c program...is that what u want?
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 08-13-2007, 04:54 PM
Member
 
Join Date: Jul 2007
Posts: 6
rach is on a distinguished road
umm..yeah...
can yu gimme a sample code?
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 08-14-2007, 03:43 PM
Member
 
Join Date: Aug 2007
Posts: 47
henry_78 is on a distinguished road
Yes..try this:
Runtime rt = Runtime.getRuntime();
String command = "cmd /c 'command_to launch_ c_program' ";
Process p = null;
try {
p = rt.exec(command);
}
catch(IOException e) {
}

This is ok if your platform is windows.
U have to substitute the 'command_to launch_ c_program' with the command that u use normaly to lanuch your c program from console..
Have fun..Bye.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an External Program through Java program Java Tip java.io 0 04-04-2008 03:40 PM
Urgent Opening in C++/Java with SIP/VoIP Satish.kumar Jobs Offered 3 03-30-2008 10:24 AM
Calling mainframe IMS program from Java babu95 New To Java 2 12-21-2007 02:08 PM
Urgent Requirement for Java/J2ee anushareddy7480 Java Announcements 1 07-23-2007 02:35 PM
Urgent Requirement for Java/J2ee anushareddy7480 New To Java 0 07-23-2007 12:56 PM


All times are GMT +3. The time now is 12:34 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org