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 Runtime exec problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Runtime exec problem" Watch "Runtime exec problem" New topic
Author

Runtime exec problem

Tobias Hetzel
Greenhorn

Joined: Apr 21, 2009
Posts: 8
Hey guys,

i coded the following snippet:



but it doesn´t work. it won´t start an editor with the blubb.txt. the other ways also don´t work:



OR



the compiler says, that it will not execute, because it´s no *.exe-file...

PLEASE HELP ME...

iTob
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

First of all, this is Windows so use \ (escaped to \\) as path separators.

Second of all, "start" is not an application of itself. It's a built-in command of cmd.exe. So you should call "cmd /c start ..." - the /c flag informs cmd to execute anything that comes after it.

And you may want to read this thread - it's handling the same problem.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32673
    
    4
Runtime.exec() is too difficult for us beginners. Moving.

And make sure to read the Daconta article which is probably referred to from the thread Rob quoted.
Dmitry Mamonov
Greenhorn

Joined: Dec 24, 2008
Posts: 28
If you just want to open some file with system defined editor then
http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html
may help you more than Runtime.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Runtime exec problem
 
Similar Threads
problem in running dos command from java
Launching a DOS batch file
How Direct Runtime.getRuntime().exec output to Console window ??
How to open command prompt from a java program
how to open new DOS window from java application