| | |
Java open internet browser
![]() |
Can somebody please provide my with usefull info how to open internet browser from java program? The way how this should work, work cross platform & open default browser don't force certain browser
I tried to use info from this page but couldn't get it work. Together with tutor we downloaded requered libraries. But when implemented compiler give us following errors, red parts mark erorr place
I tried to use info from this page but couldn't get it work. Together with tutor we downloaded requered libraries. But when implemented compiler give us following errors, red parts mark erorr place
C:\CW1 - Game\Game.java:174: unreported exception java.net.MalformedURLException; must be caught or declared to be thrown Desktop.browse(new URL ( "http://www.google.co.uk/")); C:\CW1 - Game\Game.java:174: unreported exception org.jdesktop.jdic.desktop.DesktopException; must be caught or declared to be thrown Desktop.browse(new URL( "http://www.google.co.uk/"));
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
No I don't, just simple check for action event which is build on if statement
Java Syntax (Toggle Plain Text)
else if(evt.getSource() == menuItemRules) { Desktop.browse(new URL( "http://www.google.co.uk/")); }
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Jun 2004
Posts: 2,108
Reputation:
Solved Threads: 18
Anytime you mess with a URL you'll need to catch a malformedURLException and for the desktop thing,
Java Syntax (Toggle Plain Text)
else if(evt.getSource() == menuItemRules) { try { Desktop.browse(new URL( "http://www.google.co.uk/")); } catch(MalformedURLException mue) { //error message } catch(DesktopException de) { //error message } }
Can you translate this :cheesy:
Java Syntax (Toggle Plain Text)
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jdesk top/jdic/desktop/internal/impl/ServiceManagerStub at org.jdesktop.jdic.desktop.internal.ServiceManager.getService(Unknown Source) at org.jdesktop.jdic.desktop.Desktop.browse(Unknown Source) at MainWindow.actionPerformed(Game.java:176) at java.awt.MenuItem.processActionEvent(MenuItem.java:597) at java.awt.MenuItem.processEvent(MenuItem.java:556) at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:298) at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:286) at java.awt.EventQueue.dispatchEvent(EventQueue.java:466) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh read.java:242) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre ad.java:163) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) Press any key to continue...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- Connection open, but can't open Internet? (Networking Hardware Configuration)
- Unable to open Internet Explorer, Windows Explorer, iTunes (Viruses, Spyware and other Nasties)
- My Internet Browser is Hijacked! Pls Help. (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: java help for newbie
- Next Thread: Homework HELP!!!
| Thread Tools | Search this Thread |
addball android applet application apps array automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) button card class classes client code collision columns component constructor crashcourse css database designadrawingapplicationusingjavajslider draw eclipse ee error eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer html ide image integration intellij j2me java javaarraylist javadoc javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia jvm linux loan loop method migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle phone physics plazmic print problem program programming project radio scanner server service set sharepoint smart sms smsspam software sql subclass support swing textfield threads tree trolltech unlimited utility windows






