File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Running C++ exe files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Running C++ exe files" Watch "Running C++ exe files" New topic
Author

Running C++ exe files

sarin kane
Greenhorn

Joined: Jun 13, 2006
Posts: 3
I want to run c++ exe files using the runtime environment. Its giving an error :
c:\windows\system32\ntvdm.exe
Error in setting up runtime environment
Plz help me if you can any 1.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

How do you invoke the command?

BTW: It's maximum an intermediate question.
My question is: How do you know ntvdm.exe is build from c++, and why is this important?


http://home.arcor.de/hirnstrom/bewerbung
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Hi, welcome to the ranch!

Can you post some code around the way you launch your programs? I guess System.runtime.exec( something )?

Do you know where that message comes from? Is it something in your C++ program?

See if ProcessBuilder gives you an easier way to configure and start your other programs.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
sarin kane
Greenhorn

Joined: Jun 13, 2006
Posts: 3
Hi all
See i have a c++ prog. exe that i want to run in java . The error message which i am getting has nothing to do with my c++ program.
the java prog i have written is:
try{
Runtime r = Runtime.getRuntime();
Process p = r.exec("Myprog.exe"); /*Myprog is exe of my c++ prog */
}catch(Exception e1) { System.out.println(e1); }

when i run this java prog im getting this error :
"Error in setting up environment for the application "
Please Help me !!!
sarin kane
Greenhorn

Joined: Jun 13, 2006
Posts: 3
Is the code that i have written above is corect or not?
Plz help me its urgent !!
i have tried using :
String temp = "cmd /k java -cp \"A:\MyDirectory\"MyApplication";
Process proc = rt.exec(temp);
But it doesnt work !!!
Is it possible to do it using a BAT file

Plz reply !!!
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Read this:

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?

I would first try to use the whole path to ntvdm.exe.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Usually when I Google an error message I get right to some explanation. I get no hits at all on this: "Error in setting up environment for the application" It's not often I get no hits on Google. Is that it word for word??

Try the full path to your program. Your program will not inherit any environment variables, but you can use ProcessBuilder to set some up if you need.
[ June 15, 2006: Message edited by: Stan James ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running C++ exe files
 
Similar Threads
C execute in java program
JVM and JRE
How can I embed runtime exe files in JSP
Runtime class
run exe in client sid