aspose file tools*
The moose likes Linux / UNIX and the fly likes runtime.exec in linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "runtime.exec in linux" Watch "runtime.exec in linux" New topic
Author

runtime.exec in linux

lavnish lalchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 79
hi
i have a java code , running on linux ,
Runtime.exec("java -classpath /usr/home/App1/ViewController/classes;/usr/home/lib/abc.jar model.demo.Arguments user1 user2 user3");

ON running the above i get error
java.lang.ClassNotFoundException user1

Arguments.class is in folder /usr/home/App1/ViewController/classes/model/demo
Arguments.java has package model.demo

??? Am i giving something wrong ??


lavnish.blogspot.com
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Yep,
If you want to pass multiple arguments to a command look at the exec(String[]) method.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#exec(java.lang.String[])


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Also, if you're running Java 1.5 or higher, you might want to take a look at the newer ProcessBuilder class:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: runtime.exec in linux