Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Cannot see exec()'ed app

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I exec an application, a cmd window with a helloworld app that spits out the string "Hello World", I can't actually see the cmd window. I'm using the '/k' flag, which if I understand correctly, should keep the cmd window open. I've also tried exec'ing a text file in notepad.
In both cases, I could see a cmd/notepad process start in the Process Window of the Task Manager, but the windows never actually popped up.
Anyone know why? Below is a snippet of my code.
thanks,
brian
String path = "d:\\";
String command = "cmd /k java -classpath \"" + path + "\" HelloWorld";
Process p = Runtime.getRuntime().exec(command);
- OR -
String command = "notepad c:\\text.txt";
Process p = Runtime.getRuntime().exec(command);
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Worked for me in WinNT. I got two windows up, of course the notepad window came up first and couldn't find that file. Then the java window came up just fine.

I used this code:

[This message has been edited by Cindy Glass (edited December 14, 2001).]
reply
    Bookmark Topic Watch Topic
  • New Topic