This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help? Java Command Shell

 
Travis To
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did anyone has idea how to invoke an another application within Java (Java command shell)?
My goal, is to click a button, and a IE window will be invoked. I thinks i can run the 'iexplore' within a Java by the command shell.

thanks a lot
 
Darin Niard
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Travis To
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx, But i just tried in JBuilder7 with
try{
Runtime.getRuntime().exec("iexplore www.google.com");
}
catch (Exception e){}

and when i run it, nothing happen
 
Travis To
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx, But i just tried in JBuilder7 with
try{
Runtime.getRuntime().exec("iexplore www.google.com");
}
catch (Exception e){}

and when i run it, nothing happen
 
Darin Niard
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah... you need to specify the whole path with IE for some reason. Even using "cmd /c" doesn't work.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also google for "Java exec rundll32". There are more online examples than molecules in the universe. Well, almost. Feeding a filespec or URL to rundll32 is a lot like clicking a file in Windows Explorer. Windows will open the program associated with the extension or domain (http). This should open the user's default browser which may not be IE which may or may not match your user's expectations.
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to check out BrowserLauncher for this. Nice and cross-platform.


--Tim
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic