United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6486393 : Need a KDE support in java.awt.Desktop class

Details
Type:
Enhancement
Submit Date:
2006-10-25
Status:
Open
Updated Date:
2011-04-29
Project Name:
JDK
Resolved Date:
Component:
client-libs
OS:
linux
Sub-Component:
java.awt
CPU:
x86
Priority:
P4
Resolution:
Unresolved
Affected Versions:
6
Targeted Versions:

Related Reports

Sub Tasks

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 02: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.

                                    

Comments
EVALUATION

well, it is not a bug, since Desktop API was developed to support Windows and Gnome only.
This is a reasonable RFE.
                                     
2006-10-27



Hardware and Software, Engineered to Work Together