Any new ideas for launching web browser from application

I have searched the forums trying to find a new way of launching a web browser from a java application. The problem I am having is that on Unix and Linux systems, at least the variety I have access to (not quite sure on what that variety those are as they are not my systems or systems I control), the common method of using Runtime.getRuntime().exec(STRING) with either netscape or mozilla does not work. While using the Runtime.exec method is not the same as a console, I did try on these systems "netscape + A_WEB_ADDRESS" (or mozilla) and it did launch the respective browser with the page, so it appears that at least from the console level, those commands are valid.
All the forums seem to say that the Runtime.exec method is the way to go. All the source code I have found through links from the forum say the same thing. I have voted on this bug:
http://developer.java.sun.com/developer/bugParade/bugs/4210168.html
and the feedback there does seem to indicate that there is similar trouble out there. Below is the code I am using. It does work on Win2000,XP, and Mac OSX. The application is not supported on earlier systems, and as it stands it will not work on Win 95,98, nor ME. Only small modification should be needed for work on those OSs, but as I no longer personally use those OSs, I cannot be sure.
private void openNativeBrowser(String url) {
// not the browser itself is started, i only call something like
// start http://www.javasoft.com
// and then the standardbrowser will be started ...
StringBuffer call = new StringBuffer();
System.err.println(System.getProperty("os.name"));
System.err.println(System.getProperty("user.dir"));
try {
// which OS ?
String operatingSystem = System.getProperty("os.name");
// how to call the OS
if (operatingSystem.toLowerCase().indexOf("windows") > -1)
call.append("cmd /c start ").append(url);
else
if (operatingSystem.toLowerCase().indexOf("mac") > -1)
call.append("open ").append(url + " &");
else if(operatingSystem.toLowerCase().indexOf("linux") > -1)
// use Script 'netscape'
call.append("mozilla ").append(url).append(" &");
else
call.append("netscape ").append(url).append(" &");
System.err.println(call.toString());
// start it ...
Runtime.getRuntime().exec(call.toString());
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
As I said, if you have a new way to call the broswer that seems to work on either Unix or Linux, please post it, point to it, or explain it.
Aaron

there is a shell script on Linux called htmlview that you can launch like this:
String[] cmd = {"htmlview", "http://java.sun.com"};
try {
    Runtime.getRuntime().exec(cmd);
} catch (IOException ioe) {
    // do something
}which will open the default browser. Don't think this is available on other *NIX though, although the script itself would probably work so you could include it with your app (/usr/bin/htmlview).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Any new Ideas for themes for S40 Phones?

    Any ideas for a new theme for S40 phones?

    Any ideas for a new theme for S40 phones?

  • Cannon 8800F not working with OS X yosemite 10.10.1  . I have downloaded the latest drivers and firmware from Canon. I called Canon for support and went through all the checks , but, still my iMac did not see the scanner. Any new ideas?

    cannon 8800F not working with OS X yosemite 10.10.1  . I have downloaded the latest drivers and firmware from Canon. I called Canon for support and went through all the checks , but, still my iMac did not see the scanner. Any new ideas?

    Have you done any of the following?
    http://support.apple.com/kb/PH18614 OS X Yosemite: Reset the printing system
    Repaired permissions & restarted your comp after the installations of the drivers?
    Sometimes, installing the GIMP drivers help with printing issues: http://gimp-print.sourceforge.net/MacOSX.php
    What to do when you can't print
    =============
    not working with OS X yosemite 10.10.1
    Per your profile
    Mac OS X (10.7.3)
    Conflicting info:  Please update/correct your profile so that you can receive the correct troubleshooting suggestions.  This will assist the users in trying to help you.  Thank you.

  • Launch a default web browser from my java application

    Hello,
    I have been trying to launch my default web browser from my java application, but am unable do it. Right now, I am using ---- "Runtime.getRuntime().exec("cmd /c start <url>"); to launch my webbrowser. It launches the browser but displays the command prompt for a second or so, and then replaces my already existing page with the new url.
    Is there any way for me to launch the url in a completely new browser each and every time. And I don't want the command prompt to show up for a sec. Please help...!
    Thanks in advance.
    -BusyBusyBee

    If by any chance your application is an Applet, you can use this to open a new browser window:
    getAppletContext().showDocument(new URL(theUrl), "_blank");
    But, you probably would have specified if that were the case. Oh well. Hope it helps someone!
    -sheepy.

  • HT1420 i can't seem to get my iPad to synch with my new iMac.  The iTunes prompt says that this computer isn't authorised although i have registered it on iTunes.  Any other ideas for how to overcome this block?

    i can't seem to get my iPad to synch with my new iMac.  The iTunes prompt says that this computer isn't authorised although i have registered it on iTunes.  Any other ideas for how to overcome this block?

    What do you mean by 'registered it on iTunes' ? You've authorised your account on your Mac's iTunes via the Store > Authorise This Computer menu option ? And you've copied your library onto the Mac ?
    Copying content between computers : http://support.apple.com/kb/HT4527
    You may also find this page for syncing to a new computer useful : https://discussions.apple.com/docs/DOC-3141

  • Opening a web browser from an After Effects script

    Hi,
    This may be a stupid question, but is there any way to open a web browser with a URL from an AE script, other than explicity lanuching the browser app via a sys.callSystem() command?
    I'm asking because obviously scripts need to run on both Windows and MacOS, and the user's default/preferred browser isn't necessarily going to be IE or Safari. That and I'd need to find the file path of the browser anyway somehow.
    It's to display external help.
    Thanks,
    Christian

    system.callSystem() can launch a URL without specifying the specific app. This code user's default browser. The last line is the main deal, the other stuff keeps it universal for PC and MAC.
    //CHECKS FOR USER OS
    function osCheck(){
              var op = $.os;
              var match = op.indexOf("Windows");
              if(match != (-1)){
                        var userOS = "PC";// User is on PC
              }else{
                        var userOS = "MAC";// User is on MAC
              return userOS;
    // RUNS OS CHECK FUNCTION
    var userOSVer = osCheck();
    //DEFINES PC OR MAC TERMINAL SYNTAX
    if(userOSVer == "MAC"){
              var urlLaunchCode = "Open";//Mac based
    }else{
              var urlLaunchCode = "Start";//PC based
    //ONCLICK FUNCTION FOR YOUR URL BUTTON CONTROL
    //urlLaunchCode = Open or Start / " " = keeps a space character separator / "http://myurl.com" = Defines the actual URL path
    myURLButton.onClick = function(){system.callSystem(urlLaunchCode + " " + "http://forums.adobe.com/thread/993523?tstart=0")};

  • Any difference in creating a web service from a java class or session bean?

    Hi,
    The JDeveloper tutorial at http://www.oracle.com/technology/obe/obe1013jdev/10131/devdepandmanagingws/devdepandmanagingws.htm demonstrates creating a web service from a plain java class. I'm wondering:
    - Is it possible to create a web service from a stateless session bean instead of a java class? If so, what's the proper way to do this in JDeveloper? When I tried doing so in JDeveloper 10.1.3.0.4 (SU5) using the J2EE Web Service wizard, the wizard did not list the session bean in the Component To Publish dropdown (it does list any java classes available in the project). I can proceed by manually typing in the name of the session bean. After the wizard completes though, the @Stateless annotation that had been in my session bean class code is removed and replaced by a @WebService annotation. The end result is that it looks like it made no difference whether I had tried to create the web service from a session bean or plain java class as the annotations in the resulting web service code are the same (although if I had started from a session bean, the class for the web service still implements the Local/Remote EJB interface that the session bean originally implemented).
    - Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean? I'm creating the web service from scratch so I also need to either build the java class or stateless session bean the web service would be based on from scratch too.
    Thanks for any ideas about this.

    Hi,
    EJB Session beans (EJB 3.0) are deployed as WebServices by annotating the class with @WebService and the methds with @WebMethod (both tags require you to add the JSR-181 library to your project (available in the JDeveloper list of libraries)). Unlike the J2E WebService, the EJB session bean service is turned into a WebService upon deployment. This means you obtain teh WSDL file after deployment
    - Assuming it's possible to create a web service from a stateless session bean, is there any advantage/disadvantage creating a web service from a java class vs a stateless session bean?
    The difference is that EJB Session bean based web services are integrated with the J2EE container, which means that they can leverage container services like transaction handling, data sources, security, JMS etc.
    Frank

  • Software Update doesn't have any new software for your computer at this time

    HI
    I manged to get all my updates downlaoded and on my server, i have currently enabled 133 of 400 updates.
    I have changed my snow leopard machine to point to the internal update server
    But then after a while of checking this displays software Update doesn't have any new software for your computer at this time
    Which is a Lie, because i know there are updates on the server that the computer needs to have.
    Any Ideas
    Many Thanks

    Oh i forgot to say in consol (from the client) i get can't instantiate distribution from server address  error Domain=NSXMLParserErrorDomain code=70 etc
    Any ideas anyone?

  • Are there any new features for Flex 4.6 developers?

    Hi,
    just wanted to ask if there are any new features for projects that use Adobe Flex 4.6 (i.e., Flex projects, targetting Flash Player in the browser). From what I've observed so far:
    * Design view is removed (not really a "new feature")
    * Working with imports is smarter
    * Nothing else really changed
    Is that correct? Anything else why I as a Flex developer should appreciate in Flash Builder 4.7? (We don't use Apache Flex 4.8 and will not in the near future so if there are any new features there, they don't really apply to us, 4.6 developers).
    Borek

    I mean I am having that duplication issue.....

  • Quartz Composer - Effects of Other Cards? Any New Ideas?

    I have read the discussions here about Quartz Composer, and noticed a mix of difficulties:
    1 hardware restrictions (G4 or video card)
    2 can't get preview (white screen), but can get render
    3 can get preview, but can't get render (white screen)
    4 can't get either preview or render
    5 get greyed or coloured results in renders
    I'm suffering 4 - no preview or render - but not 1 - I have a G5 2G Dual Processor, with an ATI Radeon Pro 9600. (I see ripples when widgets launch.)
    In this context, are there any new ideas?
    One observation: to find out the name of my video card, I ran system profiler, to be reminded that I have:
    - an old ATI card driving a second monitor in a PCI slot
    - an Alchemy TV card also in a PCI slot
    I know it's tempting to blame the cards for the iMovie difficulty, especially since we are talking about a video problem, and both are video cards, so I want to ask:
    - are there any people with these kinds of cards having no problem at all?
    - are there any people with similar cards experiencing similar problems?
    G5 DP2G & G4/466   Mac OS X (10.4.5)   1.5 G RAM

    "I know it's tempting to blame the cards for the
    iMovie difficulty, especially since we are talking
    about a video problem"
    Have you tried pulling out [Alchemy TV and second monitor] cards, just to rule
    them out as a source of the problem?
    No... my thinking is that I'm an amateur iMovie user, and in the end I would feel more comfortable with my second montor and (very occasionally used!) TV than with a fully working iMovie. Hence my questions were directed at finding out whether others had:
    - these problems without cards being fitted
    - no problems despite cards being fitted
    G5 DP2G & G4/466   Mac OS X (10.4.5)  

  • Can open a Web browser from the worksapce?

    Hi,
    we are using Adobe livecycle ES2.5, We are trying to add an action to our users to open a specific URL in a Web browser, is it doable?
    Thanks
    Hussam

    Thanks Nith,
    we did this before when using pdfs but in our case we are using Flex and we do not want to call the web browser from the flex we need it from the workspace directly,
    please see the attachment, when the user clicks complete we want to open the browser instead of submitting the form to the next step.
    any idea?
    Regards

  • How to open a web browser from java

    Hi
    Would anybody please help me with this. I need to open a web browser from my java app but I don't know. What method I can use?
    Thanks.
    Hung.

    You can use the Runtime class for this. It can run any command. So, you can run the .exe file of your Web browser.
    The following code will run Internet Explorer (assuming iexplorer.exe is in C:\Program Files\Internet Explorer):
    import java.lang.Runtime;
    public class Explore{
    public static void main(String[] args) {
    try{
    Process p = Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore");
    }catch (Exception e) {
    System.out.println("Exception: " + e);

  • Logon failed error when launching Web Intelligence from InfoView

    After changing the Web Intelligence preferences in BusinessObjects Enterprise XI 3.0 Java InfoView to launch the desktop or rich client option, I get a "logon failed" error message. However, when I launch Web Intelligence Rich Client from 'Start > Programs >...' directly, the same logon information is successful. The logon is set to use Enterprise authentication which is the same logon information used to launch InfoView and Web Intelligence.
    Why does the logon fail when I launch Web Intelligence from InfoView?
    Edited by: Ana on Mar 31, 2009 3:43 PM

    I deleted the report completely and rebuilt it from scratch, and also added names for the data table and data set generated within the project and finally, success!
    Jason, thanks so much for your help which got me moving on this again.

  • (268625273) Q WSI-29 Can you give any performance benchmarks for WLS web services?

    Q<WSI-29> Can you give any performance benchmarks for WLS web services?
    A<WSI-29>: It is very difficult to quantify performance aspects of web services
    since they depend on so many variables including but not limited to: backend system
    processing by stateless session beans and message driven beans, size of XML SOAP
    message sent, system hardware (CPU speed, parallel processing, RAM speed) and
    system software (JVM type and version of WebLogic server). However, let me point
    out that the EJB backend processing of requests both have the best possible scalability
    within the EJB2.0 specification (both stateless session and message driven beans
    can be pooled) and servlets have a proven scalable track record. Thus it should
    be possible to scale your web service deployment to meet demand. The overhead
    in processing XML within the servlet can be significant depending on the size
    of XML data (either as a parameter or a return type). While WLS6.1 does not have
    any features to address this performance concern, WLS7.0 will feature Serializer
    and Deserializer classes which can be dedicated to the XML to Java and Java to
    XML translation (they can also be automatically be generated from a DTD, XML Schema
    or regular JavaBean).
    It is true that web services are not the fastest way to process client requests
    but BEA is committed to making WebLogic server the fastest possible service provider.
    Adam

    see http://www.oracle.com/support/products/oas/sparc30/html/ows08811.html

  • How do I get a link within a PDF to open a new tab in a web browser?

    How do I get a link within a PDF to open a new tab in a web browser? Previous forums (for earlier versions of InDesign and Acrobat) mention something about JavaScript, but I'm using InDesign CC and Adobe Acrobat Pro CC
    Thanks.

    When you're looking at the PDF that's on your site, is it opened in the browser or directly i Acrobat/Reader? If in the borwser, do you know if it's being viewed in the browser's default PDF viewer or Acrobat/Reader? It probably won't work in non-Adobe PDF viewers.
    Are you saying that when you click the link that two new browser tabs are opened with the same URL, instead of just one as you'd expect, or something else?

Maybe you are looking for

  • Creation of New Variant

    Hello, I need a variant which does ' quant * quant = quant '. The nearest variant that I found is QUANTI12 which does ' qant / quant = factor ' . I copied the variant to Zvariant. Now I try to modify the outpout from ' factor ' to ' quant '. Someone

  • Adding weekday name to x-axis in a chart

    I am trying to add a weekday name to the horizontal axis in a chart (SSRS). In horizontal Axis Properties I went to number, then Custom, and added: =(WeekdayName(Fields!Date.Value)) It nearly works. I have put in this week's dates into the parameters

  • HTTPS communication using HTTP receiver adapter URL address as Address Type

    Hi All, If some one who has tried HTTPS communication using HTTP receiver adapter using URL address as Address type can you please guide me what are the steps need to be done. Note : Address type is a parameter in HTTP adapter setup . Regards, Reddy

  • Want to stream screencast in flash

    Me and my brother want to create a live screencast display for our guild website based on the game Counterstrike. Basically, we want to transfer all video and audio that we experience in the game, and transmit it live to our guild members so that the

  • Windows 7 jump list in swing application

    Dear all, what is the best way for a hobby programmer to create a windows 7 jump list in a desktop swing application. Does someone know a good example how to do e.g. the jni-calls? I know there is a 7Goodies commercial product, but its too expensive