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

Runtime exec problem

 
Tobias Hetzel
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47244
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic