Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching apps silently?

Status
Not open for further replies.

sirugo

Programmer
Aug 1, 2000
162
SE
How do I lanuch another app from my java-app?

I want to launch both Explorer and Firefox silently in the background and give them both the same URL, let's say After that I want the both browsers to terminate their activity.

Can it be done?
How?
 
Well, you can use the Runtime class's exec() method to run command lines in the environment. I don't know if IE or Firefox can be launched 'silently'. They are designed to interact with the user and I'd expect they'd present a visible GUI pretty much as a given.

Maybe you have deeper requirements which makes you ask this question? If you want to invisiblty process pages from a web server you could use sockets to get at it, or use the higher-level java.net.HttpURLConnection class, or even an Open Source library such as the Apache Commons HttpClient.

Tim
 
As tim said, more information is needed. My first thought is that what you need is not a Java program but a batch file.

Cheers,
Dian
 
OK, this is exactly what I'm doing.

Originally I have a C++ app that takes the username logged on to a Novell net. It creates a hash of the username and launches Explorer at a given URL which stores a cookie with the hash. This hash is used to look up the user in a database for an intranet which makes the user automatically logged in to that intranet.
Now this works perfectly with C++ and Explorer launches silently in the background with ShellExecute and the SW_HIDE parameter.
Also the C++ app launches Firefox but it won't do it silently which gives me a headache. I don't understand why it works with Explorer and not with Firefox.
Also I tried to close Firefox using window.close with Javascript but that gives me an annoying popup.

That's why I tried to see if there is a better way to do this with Java.
 
Because the users use both Explorer and Firefox and the Explorer-cookie won't be available to Firefox.
So I must do it for both applications to have the users logged in automatically no matter which browser they're using.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top