开发者

java.awt.Desktop.browse returns "The requested lookup key was not found in any active activation context" only on Win XP

I use the following code to access the default browser from java when a button is clicked:

if( !java.awt.Desktop.isDesktopSupported() ) {
    System.err.println( "Desktop is not supported (fatal)" );
}
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();

if( !desktop.isSupported( java.awt.Desktop.Action.BROWSE ) ) {
    System.err.println( "Desktop doesn't support the browse action (fatal)" );
}

String number = txtInCall.getText();

String uriString = "http://localwebserver/new?number="+number;
//number only contains numbers similar to 023456789
try {
    java.net.URI uri = new java.net.URI( uriString );
    desktop.browse( uri );
}
catch ( Exception ex ) {
    System.err.println( ex.getMessage() );
}

The programm works well on Windows 7 Home Premium x64. If I test it on Windows XP Professional x32 SP3 the console returns: "The requested lookup key was not found in any active activation context".

I googled about it and found out, that the error occurs in connection with Internet Explore. The default browser on the tested machines howerer is Mozilla Firefox 6.0.2. I also checked the registry and the http-protocol is registered开发者_如何转开发 for firefox.exe and I updated IE.

The other question about this error did not help me either. On the XP machine a click always returns the mentioned error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜