This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Run a ProC or C file from Java

 
Atanu Das
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am able to run a notepad.exe from java code by

<blockquote>code:
<pre name="code" class="core">import java.io.*;
import java.util.*;

class runProc
{

public runProc()
{
try {
String[] cmd = {"notepad.exe"}; // C://TCC//ADG.EXE substitute notapad with this.
Process p=Runtime.getRuntime().exec(cmd); //tell the path.
p.waitFor();
System.out.println("i am in try block");
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{

runProc runP = new runProc();
}
}
</pre>
</blockquote>
this code. but, if I want to run a C exe file or a pro C file from Java , then How to do that??
Please reply
[ July 16, 2008: Message edited by: Atanu Das ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

What differentiates an executable written in C from any other executable like notepad.exe? Or, to put it another way, what exactly happens when try it?

Make sure you handle the input/output/error streams as this article explains.
 
Atanu Das
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
You can run my code to see the problem. It is giving some error (16bit MSDOS error) as:

C:\WINDOWS\SYSTEM32\NTVDM.EXE
ERRORR WHILE SETTING UP ENVIRONMENT FOR THE APPLICATION.


PLEASE HELP AS EARLY AS POSSIBLE.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic