wood burning stoves 2.0*
The moose likes Java in General and the fly likes How to run a java File using RunTime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to run a java File using RunTime" Watch "How to run a java File using RunTime" New topic
Author

How to run a java File using RunTime

Ramesh Shanmugam
Ranch Hand

Joined: Sep 13, 2004
Posts: 132
I have java file which is running on Websphere Application Studio (WSAD). From the Java file i need to invoke a java file to run as like it runs on command prompt. So what i did is i got the RunTime instance and tried to execute the java file like

Runtime.getRunTime.exec("java -cp classpath JavaFilename);

the system was not showing any result or error. Please help me to get it resolved and run the java file


Ramesh Shanmugam - SCJP 1.5
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
Try using an absolute path for "java", i.e. something like "/usr/bin/java". You may also have to use absolute file paths in the classpath.

You should also read this article; you may have to handle I/O as described in it.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to run a java File using RunTime
 
Similar Threads
executable without any JDK???
executing java program
running another application from java
Problem running exe file in program files thru java
Any Solution for this.