Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-14-2008, 06:43 PM
Member
 
Join Date: Jun 2008
Posts: 2
hknyo is on a distinguished road
Runtime.exec()
Hi all,
I am launching some external applications from java Runtime.exec(). It works fine when everything goes well(i.e the application path is correct, file to launch is ok. etc...) but I wonder is there any way to determine if the application is installed before I launch, since I believe Runtime.exec() does not provide much control after it is called. I just need to know how I can determine if the application exists(installed) before I launch from java . It doesn't have to be using java Runtime but any method would be fine. here is my general scenerio

1. 1 of 2 applications to lunch
2. I can assume that the user will have at least one of them installed
3. depending on what is installed, I willl launch using it
4. if both of them are installed, I will give the user to select one of them.


Thanks in advance
Nick
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-14-2008, 07:54 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Gone to Costa Rica
Posts: 2,223
Norm is on a distinguished road
I assume that the applications are files located somewhere on the OS's path (the PATH environ var in windows, I don't know about other OS). If you can get the value of PATH, then you could look on all the paths for the file that starts the application.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-16-2008, 02:40 AM
Member
 
Join Date: Jan 2008
Posts: 22
mrcheeks is on a distinguished road
You can use the file methods
if(new File(myapplicationFullPath).exists()){
Runtime.getRuntime().exec(myapplicationFullPath);
}
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Runtime.exec() nhabibi Advanced Java 11 07-02-2008 03:35 AM
Runtime.exec(), handling input and output streams crookshank New To Java 0 06-05-2008 04:41 PM
Ant exec task JavaForums Java Blogs 0 05-20-2008 02:40 PM
Exec cmd from Java application javaplus New To Java 0 12-17-2007 10:41 AM
Nuxeo Runtime 1.2 JavaBean Java Announcements 0 06-22-2007 08:01 PM


All times are GMT +3. The time now is 04:52 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org