File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

runtime.exec in linux

lavnish lalchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 79
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 has package model.demo

??? Am i giving something wrong ??
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

If you want to pass multiple arguments to a command look at the exec(String[]) method.[])

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

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:
I agree. Here's the link:
subject: runtime.exec in linux
It's not a secret anymore!