|Summary:||AWT-free alternative to java.awt.Desktop.browse(URI)|
|Product:||[JogAmp] Newt||Reporter:||Julien Gouesse <gouessej>|
|Component:||core||Assignee:||Julien Gouesse <gouessej>|
Description Julien Gouesse 2015-05-26 14:58:34 CEST
AWT has a method that allows to launch the default browser to display a URI. It doesn't work under GNU Linux with KDE. There is not yet any alternative to this method in NEWT. The method org.lwjgl.Sys.openURL(String URL) of LWJGL 2 is a good source of inspiration: https://github.com/LWJGL/lwjgl/blob/master/src/java/org/lwjgl/Sys.java#L232 It uses Java Webstart first and it has several platform-dependent fallbacks. I suggest to modify them a little bit: - $BROWSER, "xdg-open", "gnome-open", "kde-open", "x-www-browser" or "sensible-browser" under GNU Linux - "open" under Mac OS X (instead of com.apple.eio.FileManager.openURL()) - "rundll32 url.dll,FileProtocolHandler" under Microsoft Windows - new Intent(Intent.ACTION_VIEW, Uri.parse(String URL)) and startActivity(intent) under Android
Comment 1 Julien Gouesse 2015-05-26 15:44:56 CEST
XFCE uses exo-open, it should be called if the xdg-utils package isn't installed. Maybe "cmd /c start" can be used under Windows: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx
Comment 2 Sven Gothel 2015-07-28 14:51:00 CEST
Why shall this feature be part of NEWT? While I see the short-cut benefits of kicking off a native browser, I would prefer seeing html/css rendering via OpenGL/Graph purely performed within Java. Further, launching an external browser might also be considered a security risk, since the launch requires privileged mode and the browser itself cannot be considered secure. If there are no others liking to introduce this features, I would like to mark this entry invalid, while open a new bug report introducing the need for a Java browser using OpenGL/Graph.
Comment 3 Julien Gouesse 2015-07-28 20:06:44 CEST
This kind of feature is commonly used by some major free softwares, for example Notepad++ and TortoiseGit. Numerous Android applications use it too in order to redirect the end users to a website. Is there a way of providing a safe implementation of this feature? I can implement it (I need it for my own native update system) but I don't see why it wouldn't be part of NEWT. Creating a Java web browser for such a rudimentary need is like using a nuclear bomb to kill a butterfly to me.
Comment 4 Julien Gouesse 2017-01-17 15:21:12 CET
I tried to use JCEF, the build files were half-broken, the source code contained a very few compile errors and there were so much problems that I gave up. It worked somehow in very simple cases but I didn't find a way of shutting it down cleanly. I tried gngr too but it doesn't have enough features, it's a very poor web browser. I ended up by using The DJ Project "Native Swing". It seems to launch a native browser embedded into a Swing component: http://djproject.sourceforge.net/ns/index.html If you don't need to embed a browser in your software, my first suggestions will be enough. Sven is right, opening a website in the default web browser doesn't need to be a part of NEWT even though it's an AWT feature whereas displaying HTML/CSS content within JOGL with the Graph API would make sense.