Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  is it possible to launch default web browser from java program?  (Read 615 times)
0 Members and 1 Guest are viewing this topic.
Offline kylix999

Full Member
**

Posts: 193



« on: 2006-02-07 09:32:34 »

i would like to make  my program  able to launch a web browser for example mozilla with some address url.
 it can be made using Proccess.exec, but i was thinking is it possible to do it in another way to launch DEFAULT user browser and also it should work on all platforms, of course i am talking about java programs not applets
Offline jbanes

JGO Neuromancer
****

Posts: 1178


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #1 on: 2006-02-07 09:51:18 »

If you were using an Applet, it would be easy. (Check the Applet methods for more info.) Otherwise your best option is JDIC. Webstart also provide the "showDocument()" method in javax.jnlp.BasicService.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline kylix999

Full Member
**

Posts: 193



« Reply #2 on: 2006-02-07 10:17:09 »

jdic is very intresting, i also found intresting article about it here:
http://www-128.ibm.com/developerworks/java/library/j-jdic/
but i was thinking is it poosible to make it withut native libs, but this is also good, thanx jbanes

and there is also jrex :  http://jrex.mozdev.org/docs.html
Games published by our own members! Go get 'em!
Offline jbanes

JGO Neuromancer
****

Posts: 1178


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #3 on: 2006-02-07 10:27:21 »

Glad to be of service. Just so you know, there's also the Browser Launcher library that's (supposedly) 100% Java. JDIC, OTOH, is slowly moving into the Java core, starting with release 1.6. So it's something of a toss-up as to which option is "better". Good luck!

Java Game Console Project
Last Journal Entry: 12/17/04
Offline swpalmer

JGO Kernel
*****

Posts: 3438
Medals: 4


Where's the Kaboom?


« Reply #4 on: 2006-02-07 10:30:38 »

it is easy to do without native libs.

Check the platform and run the command line that makes sense for the OS you are on.

Mac OS you can use "open  <url>"
Windows has a couple options, "cmd /C start /B <url>" works,and a more direct way, (I think this works) is "rundll32 SHELL32.DLL,ShellExec_RunDLL <url>"
Linux... is more troublesome Smiley

Offline kylix999

Full Member
**

Posts: 193



« Reply #5 on: 2006-02-07 10:46:22 »

you are the best guys, browser launcher is that what i was looking for, but it is quite old and some functions especially for macintosh are not working , but there is a new implementation of launchbrowser here which is the best and free: http://browserlaunch2.sourceforge.net
and supports probably all systems:

Linux (2.4.x or higher)     FireFox, Mozilla, Netscape, Konqueror, Opera     Supported     Supported     
Mac OS X (10.2 or higher)       Supported    
SunOS    Mozilla, Firefox, Netscape    Supported    Supported    The default browser is invoked using the sdtwebclient command.
Windows 2000    Mozilla, Firefox, IE    Supported    Supported.    
Windows 2003    Mozilla, Firefox, IE    Supported    Supported.    
Windows 98    Mozilla, Firefox, IE    Supported    Supported.    
Windows NT    Mozilla, Firefox, IE    Supported    Supported.    
Windows XP    Mozilla, Firefox, IE    Supported    Supported.

and some intresting discussion can be found here: http://www.codecomments.com/archive245-2005-12-724947.html

also you may be intrested in this project :   http://multivalent.sourceforge.net/

again thanx guys
Offline TheAnalogKid
« League of Dukes »

JGO Wizard
*****

Posts: 1307
Medals: 2



« Reply #6 on: 2006-02-07 12:42:17 »

Mustang provides an API to launch the default browser and other tools such as email client. Check on javasoft.com for the article on the API. Of course you have to stick to Java 6, which may have a major impact on the deployment of your app.

Offline kylix999

Full Member
**

Posts: 193



« Reply #7 on: 2006-02-12 08:51:03 »

browser email client in mustang cool, more can be found here:
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/mustang/desktop_api/


thanx TheAnalogKid
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.149 seconds with 20 queries.