Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java
Expertise: Beginner
Aug 17, 1998



Application Security Testing: An Integral Part of DevOps

Process class

Using VCafe 2.8 in a Win95 enviornment, I'm trying to spawn a local executable during the runtime of a Java application. I've tried using:

Process p = Runtime.getRuntime().exec(strCmd);
but the only value of "strCmd" that was successful was strCmd = "c:\command.com /c dir"

I'm really trying to run something like Windows Notepad, or even a *.bat file.

The only reason you found you had to use command.com to invoke a program is because the command you used in your test program is not an actual executable. The dir command is part of the command.com shell and cannot be executed separately. If you change your command string to "C:\WINDOWS\NOTEPAD.EXE", you should have no problem launching the program. But when executing shell commands like dir, you must invoke command.com.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date