|
Description
|
FULL PRODUCT VERSION :
jdk-6-rc-b100
ADDITIONAL OS VERSION INFORMATION :
Linux feather3 2.6.15-27-686 #1 SMP PREEMPT Sat Sep 16 customer :13:27 UTC 2006 i686 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=6.06
DISTRIB_CODENAME=dapper
DISTRIB_DESCRIPTION="Ubuntu 6.06.1 LTS"
!!! KUBUNTU - KDE desktop !!!
A DESCRIPTION OF THE PROBLEM :
The Desktop class apparently is only looking for a Gnome browser. It does not try to look for Mozilla, FireFox or even Konqueror:-( So it fails when you don't run on a Gnome desktop.
[pid 15878] execve("/export/home/marcow/bin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or d
irectory)
[pid 15878] execve("/usr/local/sbin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory
)
[pid 15878] execve("/usr/local/bin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/usr/sbin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/usr/bin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/sbin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/bin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/usr/bin/X11/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/usr/games/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/export/home/marcow/usr/vspms/bin/linux/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/export/home/marcow/usr/vspms/bin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such
file or directory)
[pid 15878] execve("/opt/Forte/teamware/bin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
[pid 15878] execve("/export/home/marcow/usr/vspms/bin/linux/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (N
o such file or directory)
[pid 15878] execve("/export/home/marcow/usr/vspms/bin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such
file or directory)
[pid 15878] execve("/opt/Forte/teamware/bin/gnome-www-browser", ["gnome-www-browser", "http://www.sun.com"], [/* 46 vars */]) = -1 ENOENT (No such file or directory)
But I could not find any way to influence that behavior short of creating a symlink. No documentation or anything for what the browse action is actually looking:-( The IOException is not very helpful either:-(
I gave this a high severity because it's not easy to find out what's wrong and how to fix it. I originally ran into this problem with NB 6.0/trunk. So other people will probably have the same problem.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the test case on a system without any gnome-www-browser.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Open a browser.
Or give a useful error message if it can't find a browser.
ACTUAL -
java.io.IOException: Failed to show URI:http://www.sun.com
at sun.awt.X11.XDesktopPeer.launch(XDesktopPeer.java:75)
at sun.awt.X11.XDesktopPeer.browse(XDesktopPeer.java:64)
at java.awt.Desktop.browse(Desktop.java:368)
at javaapplication1.Main.main(Main.java:33)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* Main.java
*
* Created on October 25, 2006, 1:24 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package javaapplication1;
import java.awt.Desktop;
import java.net.URI;
/**
*
* @author marcow
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(new URI("http://www.sun.com"));
}
catch (Exception e) {
e.printStackTrace();
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Create a a gnome-www-browser as a symlink to the browser of choice.
Posted Date : 2006-10-25 22:49:39.0
|
|
Comments
|
Submitted On 05-FEB-2007
Running JDK 6:
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
On Fedora Core 5 with Gnome (2.14.3, built 02/08/06), have the same problem because I have no "gnome-www-browser" in my path... As all Fedora installs I've seen, firefox is my default browser...
Can this be switched back to bug status?
Submitted On 05-FEB-2007
Couldn't the application configuration files be used?
~/.local/applications/defaults.list
~/.local/applications/mimeinfo.cache
/usr/share/applications/defaults.list
/usr/share/applications/mimeinfo.cache
Submitted On 14-NOV-2008
Puce
Though I can open the browser using the Desktop class, I have problems with mail:
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode)
on openSuSE Linux 10.3 and KDE.
I would like to start KMail (which is configured as the default e-mail client), but get the following exception:
Exception:
java.io.IOException: Failed to show URI:mailto:foo@bar.com
at sun.awt.X11.XDesktopPeer.launch(XDesktopPeer.java:75)
at sun.awt.X11.XDesktopPeer.mail(XDesktopPeer.java:60)
at java.awt.Desktop.mail(Desktop.java:456)
at testproject.DesktopTest.main(DesktopTest.java:24)
SSCCE:
package testproject;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class DesktopTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws URISyntaxException {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.MAIL)) {
try {
Desktop.getDesktop().mail(new URI("mailto:foo@bar.com"));
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
I think this is a bug and not an enhancement for several reasons:
- Exceptions are thrown though isSupported returns true
- If its a KDE configuration problem, it should be documented
- If KDE is not supported, at least the isSupported method should return false and the Javadoc should state this clearly.
But really hope that the rumor about KDE not being supported is not true. Otherwise we end testing if we run on Gnome or not, and have to run different code, which would contradict the central Java philosophy "Write once, run everywhere".
This really should work for KDE, too, but better for all Linux desktops supporting stuff like system tray, standard browser, standard mail client etc.
Talk with the KDE guys if you need cooperation to make it work on KDE.
Talk with the Linux guys if a new layer is needed to support all desktops.
Submitted On 14-NOV-2008
Puce
Related issues:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6490730
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6448876
Submitted On 14-NOV-2008
Puce
It should have a higher priority, since it breaks "Write once, run everywhere"
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|