Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / October 2006

Tip: Looking for answers? Try searching our database.

execute java app from within java

Thread view: 
Petterson Mikael - 25 Oct 2006 11:46 GMT
Hi,

Is there another way of launching a java program, from within another
java program, than using:

Runtime r = Runtime.getRuntime();
Process p = r.exec("c:/javac/bin/java -classpath c:\\Michael Sample");

What I want to do is to check if I have infocenter ( part of Eclipse)
running if not then I need to fire up eclipse's infocenter using command
(this is from a shell script):

java -classpath
$ECLIPSE_HOME/plugins/org.eclipse.help.base_3.2.0.v20060601.jar
org.eclipse.help.standalone.Infocenter -command $1 -port
$INFOCENTER_PORT -eclipsehome $ECLIPSE_HOME -noexec -data $data  -host
`hostname`

cheers,

//mikael
Simon - 25 Oct 2006 14:03 GMT
Petterson Mikael schrieb:
> Hi,
>
[quoted text clipped - 3 lines]
> Runtime r = Runtime.getRuntime();
> Process p = r.exec("c:/javac/bin/java -classpath c:\\Michael Sample");

If it's on the classpath, just call (maybe in a separate Thread?)

 Sample.main(new String[0]);

If it is not, use your own class loader to load the class from "C:\Michael" and
then call main(), possibly using reflection.
Note that when both programs are running in the same JVM they may of course
interfere by accessing static methods and fields etc.

(Don't know about Eclipse, though, but that doesn't seem to be relevant here.)

Cheers,
Simon


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.