| | |
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 |
-xlint actionlistener android api applet application array arrays automation bi binary blackberry block bluetooth character class client code compile compiler component consumer database desktop developmenthelp eclipse error fractal freeze ftp game gameprogramming givemetehcodez graphics gui health html ide image integer j2me j2seprojects java javac javaee javaprojects jetbrains jni jpanel jtable julia learningresources lego linked linux list login loops mac main map method methods mobile netbeans notdisplaying number online printf problem program project properties qt recursion researchinmotion rotatetext rsa scanner screen server set singleton sms sort sql string swing system textfields threads time title tree tutorial-sample update variablebinding windows working xor






