Easiest way to launch a link to the default browser from java?

Is there an easy way to launch a link in the default browser from java? Ideally I would have a graphic in a cell that when clicked on would open a new window/tab in the default browser. This would be done in SWT, but it might be similar to swing, awt, etc. Any ideas?

If you are using Java 1.5 or earlier, I found the browser launch code found here to work fairly well: http://www.centerkey.com/java/browser

Similar Messages

  • How do I change the default browser from Firefox to MS Internet Browser?

    I selected Firefox as my default browser and would like to return to MS Explorer.
    == Changed from MS to Firefox, now cannot get it back.

    Control Panel > Internet Options: Programs
    Put a check in the box next to 'Internet Explorer should check to see whether it is the default browser'
    Start IE and let IE make itself the default browser.
    Start > Default Programs > Set program access and computer defaults
    Control Panel > Programs > Default Programs > Set program access and computer defaults

  • How to open a URL in the default browser via CC HTML Extension?

    Hi,
    I'm trying to open a link via the default browser in a HTML Extension for Photoshop CC built with Extension Builder 3.
    With the initial example the "/indext.html" it look like this:
    <li><button class="default" id="btn_PHXS" onClick="onClickButton('PHXS')" disabled="true">Run ps code</button></li>
    and I changed the code from "/ext.js" to:
    ...function onClickButton(ppid) {    var csInterface = new CSInterface();    csInterface.openURLInDefaultBrowser('http://www.adobe.com');}...
    This is what the "/lib/CSInterface-4.0.0.js" looks like:
    * Opens a page in the default system browser.
    * @param url   The URL of the page to open. Must use HTTP or HTTPS protocol.
    * @return One of these error codes:\n
    *      <ul>\n
    *          <li>NO_ERROR - 0</li>\n
    *          <li>ERR_UNKNOWN - 1</li>\n
    *          <li>ERR_INVALID_PARAMS - 2</li>\n
    *          <li>ERR_INVALID_URL - 201</li>\n
    *      </ul>\n
    CSInterface.prototype.openURLInDefaultBrowser = function(url)
        return cep.util.openURLInDefaultBrowser(url);
    Since "util" doesn't seem to be defined  I get the message:
    Uncaught TypeError: Cannot call method 'openURLInDefaultBrowser' of undefined
    Is the something missing?
    Thx,
    frankin

    Hi Franklin,
    Apologies for the delay but I have been trying to determine why this API is not been working. I have since discovered that, although this API is documented in the JS library, the behaviour has yet to be implemented into Photoshop CC. Offline I will try to determine why this API was included in the library when it was not ready but for the meantime, if you would like to open a browser, here is a workaround:
    Instead of using:
    //(new CSInterface).openURLInDefaultBrowser("http://www.adobe.com")
    // Use the createProcess API to open a browser. The following shows a workflow in Windows to open Internet Explorer.  
    var csInterface = new CSInterface();
    var rootDir = "/";
    var isWindows = window.navigator.platform.toLowerCase().indexOf("win") > -1;
    if (isWindows) {
                        rootDir = csInterface.getSystemPath(SystemPath.COMMON_FILES).substring(0, 3);
    var processPath = "/usr/bin/open";
      if (isWindows) {
        processPath = rootDir + "Windows/explorer.exe";
    var url = "http://www.adobe.com";
    window.cep.process.createProcess(processPath, url);
    Apologies for this inconvenience but we promise to keep you informed when openURLInDefaultBrowser API is fully supported.
    Kind regards,
    Lea

  • I am still running OS x 10.5.8 what is the next step up and the easiest way to get it. Does the Genius bar have the capability to get me to the most recent software if I take my Imac in

    I am still running OS x 10.5.8 what is the next step up and the easiest way to get it. Does the Genius bar have the capability to get me to the most recent software if I take my Imac in

    iMac G5 - you are at the end of the line, though you may be able to upgrade your RAM, or hard drive.
    iMac CoreSolo, CoreDuo - you can upgrade to 1 GB of RAM or 2 GB of RAM and get up to 10.6.8.
    iMac Core2Duo - you can upgrade to 2 GB of RAM or more and get up to 10.7.2.
    Go to Apple menu -> About This Mac to determine which Mac model you have.
    Here's what you have to watch out for on 10.6 to 10.6.8.
    Here's what you need to watch out for on 10.7 to 10.7.2.
    Some stores may not have 10.6 installer CD available, or may not have 10.7 Flash drive available.  For those you have to make the purchase from elsewhere,
    and bring it in to the store with you.  http://www.apple.com/retail has phone numbers for all their stores, and extension 5 often will get you a real person at the store, though if yuo don't get it, you might try a different extension.

  • Is there a way to delete multiple pictures at the same time from the iphone4s?

    Is there a way to deleter multiple pictures at the same time, from my iphone4s? I know how to delete one at a time. Thanks

    Open your Photos App > Camera Roll > At the top right corner you will see a rectangle with a right arrow, select that. Now you can select as many photos as you want and you can hit the red Delete button on the bottom right.

  • I was doing some thing on my mac and the normal link to the applications folder from the bottom right hand corner disappeared, I cant find it anywhere, Can you help me?

    I was doing some thing on my mac and the normal link to the applications folder from the bottom right hand corner disappeared, I cant find it anywhere, Can you help me?

    Simple process. If an iPhone go to the Apple Store and not Verizon
    the phone from Verizon will be a refurbished device and not new unless under the 14 day worry free guarantee
    good luck

  • Open link in users default browser instead of the AIR built in one

      Hi, i am creating an AIR application using Web thejnology(html,javascript and css). The problem is that i have a link and when clicking on it the link is opened in the AIR browser not in the users browser. Is it possible to open the link in the users browser? This is how i done it :  <a href="https://www.designersbookshop.com/" target="_blank" >Click here to visit us!</a>

    To do this for all links, set the HTMLLoader object'snavigateInSystemBrowser property to true.
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/html/HTMLLoader.h tml#navigateInSystemBrowser

  • I created a word document with hyperlinks. When my default browser is Chrome the hyper links work. When the default browser is Safari, the hyperlinks bring to pages that just lines and lines of symbols. I need these links to work in both browsers.

    I created a word document with hyperlinks. When my default browser is Chrome the hyper links work. When the default browser is Safari, the hyperlinks bring to pages that just lines and lines of symbols. I need these links to work in both browsers. Any ideas?

    version 10.6.8

  • When I click a link in email client (apple mail), it does not open in firefox. I have checked both Firefox and Safari and Firefox is the default browser.

    When clicking a link in either apple mail or even from a word document, nothing happens.

    Try to redo the default browser and make another browser like Safari the default and then let Firefox do it again.
    See:
    * [[How to make Firefox the default browser]]
    * [[Setting Firefox as the default browser does not work]]
    * http://kb.mozillazine.org/Default_browser

  • Firefox is set as the default browser, but if I click a link in MS Word, the link is opened with MS Internet explorer. Why?

    Firefox is set as the default browser, but if I click a link in MS Word, the link is opened with MS Internet explorer. Why?

    What version of Windows and Office is it? I had this issue with an older version of office and Windows XP. Basically, MS are using their browser (IE) because it's their software (MS Office). If you go to options in MS word though, you should be able to find an option to set the default browser to open links.

  • Outlook keeps opening links in Internet Explorer, regardless of Firefox being the default browser

    I have Firefox 4.0.1 running on a Windows 7, 64-bit computer. I have Internet Explorer 9.0.8112.16421 installed as well.
    I use Outlook here at work and have Outlook version 14.0.5128.5000 installed, which is part of Microsoft Office Home and Business 2010.
    I have tried to set Firefox as the default browser on the computer. When I go to Start->Default programs, Firefox is set to default. When I open Firefox and check in settings, it says it is currently the default browser. I have tried to set IE as the default, then switch back to Firefox etc. But still regardless of this, Outlook opens all links in emails in Internet Explorer.
    It is very annoying as IE is a lot slower than Firefox, especially when I already have Firefox runnint and Outlook needs to start a new session of IE every time I open a link.
    Does anyone know how I can force Outlook to open links in Firefox when Firefox is already the default browser on the computer but Outlook still opens links in IE?

    I have the same problem (roughly) - I have PDF hyperlinks in an Excel spreadsheet and, when clicked, instead of them opening directly in Acrobat (or via Firefox, my default browser), they open via IE. Regular HTML links in the Excel spreadsheet open in Firefox.
    I have enabled the '''Block PDF files' access to all web sites''' option under ''Trust Manager'' category in the Adobe Reader ''Preferences'' tab.
    I have also disabled the '''Adobe PDF Link Helper''' Extension in the ''Manage Add-ons'' tab in IE.
    Obviously, neither of these settings made any difference.
    * Windows XP Pro SP3
    * Microsoft Office Excel 2003 SP3
    * Internet Explorer 8.0
    * Adobe Reader X (Version 10.1.1)
    * Firefox 8.0

  • How do you make Firefox the default browser when the normal way doesnt work?

    Im trying completely from chrome after a friend showed my how much firefox has got its act together. However i cant for the life of me set it as the default browser. I have tried the "make firefox the default browser" button in firefox, which simply opens the windows default programs panel. Whenever i try to use the panel it simply sets the http protocol to nightly which isnt even installed!( http://puu.sh/2vJHM ) I think a possible fix would be to manually change the registry, but i wouldnt know where to start.

    Did you check the box on ''Options > Advanced > General >[X] "Always check to see if Firefox is the default browser on startup"?
    Have you restarted Firefox and if so, or when you do so, what does that section on the advanced Firefox options show?
    Have you tried restarting your system after setting the default browser using the second suggestion and, after restart, check the setting per the second suggestion to see if that setting is holding?
    Updating your Plugins would have no affect on the default browser question. It was something that you needed to do to avoid security issues online by using an out of date version of Java. Java is not involved in the default browser issue. That is why I separated it from the first part of the reply with a line and began with the word "Other".

  • Is there a way to make Firefox the default browser?

    No more detail is needed

    hello cole_l, yes - please see [[Make Firefox the default browser on Android]] for instructions.

  • Launching Browser from Java when Browser URL is very  long

    Hi,
    I am trying to launch a browser from Java.
    I am doing the following.
    String command = "cmd" + "/c" + "start" + " browserURL";
    Process p = Runtime.getRuntime()exec(command);
    Note: My browserURL is very long.
    Now the browser is invoked. But the URL shown is incomplete and hence
    browser is unable to open the required application.
    Can someone help me in this.
    One way is to increase the buffer size on the command prompt?
    Is there any java command for this?
    Is there any other way to solve this issue.
    Thanks,
    AR

    this is my second time posting this, take note of it. I can't remember where i got it from, but credits go to the person that wrote it. It has helped me out thousands of times!!!
    to use, compile, then call from your program:
    org.newio.utils.BrowserLauncher.openURL("your url here")dfwtc
    package org.newio.utils;
    import java.io.File;
    import java.io.IOException;
    import java.lang.reflect.*;
    public class BrowserLauncher
        private static int jvm;
        private static Object browser;
        private static boolean loadedWithoutErrors;
        private static Class mrjFileUtilsClass;
        private static Class mrjOSTypeClass;
        private static Class macOSErrorClass;
        private static Class aeDescClass;
        private static Constructor aeTargetConstructor;
        private static Constructor appleEventConstructor;
        private static Constructor aeDescConstructor;
        private static Method findFolder;
        private static Method getFileType;
        private static Method makeOSType;
        private static Method putParameter;
        private static Method sendNoReply;
        private static Object kSystemFolderType;
        private static Integer keyDirectObject;
        private static Integer kAutoGenerateReturnID;
        private static Integer kAnyTransactionID;
        private static final int MRJ_2_0 = 0;
        private static final int MRJ_2_1 = 1;
        private static final int WINDOWS_NT = 2;
        private static final int WINDOWS_9x = 3;
        private static final int OTHER = -1;
        private static final String FINDER_TYPE = "FNDR";
        private static final String FINDER_CREATOR = "MACS";
        private static final String GURL_EVENT = "GURL";
        private static final String FIRST_WINDOWS_PARAMETER = "/c";
        private static final String SECOND_WINDOWS_PARAMETER = "start";
        private static final String NETSCAPE_OPEN_PARAMETER_START = " -remote 'openURL(";
        private static final String NETSCAPE_OPEN_PARAMETER_END = ")'";
        private static String errorMessage;
        private BrowserLauncher()
        private static boolean loadClasses()
            switch(jvm)
            default:
                break;
            case 0: // '\0'
                try
                    Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
                    macOSErrorClass = Class.forName("com.apple.MacOS.MacOSError");
                    Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
                    Class appleEventClass = Class.forName("com.apple.MacOS.AppleEvent");
                    Class aeClass = Class.forName("com.apple.MacOS.ae");
                    aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
                    aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[] {
                        Integer.TYPE
                    appleEventConstructor = appleEventClass.getDeclaredConstructor(new Class[] {
                        Integer.TYPE, Integer.TYPE, aeTargetClass, Integer.TYPE, Integer.TYPE
                    aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] {
                        java.lang.String.class
                    makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class[] {
                        java.lang.String.class
                    putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[] {
                        Integer.TYPE, aeDescClass
                    sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[0]);
                    Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
                    keyDirectObject = (Integer)keyDirectObjectField.get(null);
                    Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID");
                    kAutoGenerateReturnID = (Integer)autoGenerateReturnIDField.get(null);
                    Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID");
                    kAnyTransactionID = (Integer)anyTransactionIDField.get(null);
                    break;
                catch(ClassNotFoundException cnfe)
                    errorMessage = cnfe.getMessage();
                    return false;
                catch(NoSuchMethodException nsme)
                    errorMessage = nsme.getMessage();
                    return false;
                catch(NoSuchFieldException nsfe)
                    errorMessage = nsfe.getMessage();
                    return false;
                catch(IllegalAccessException iae)
                    errorMessage = iae.getMessage();
                return false;
            case 1: // '\001'
                try
                    mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
                    mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
                    Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
                    kSystemFolderType = systemFolderField.get(null);
                    findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[] {
                        mrjOSTypeClass
                    getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[] {
                        java.io.File.class
                    break;
                catch(ClassNotFoundException cnfe)
                    errorMessage = cnfe.getMessage();
                    return false;
                catch(NoSuchFieldException nsfe)
                    errorMessage = nsfe.getMessage();
                    return false;
                catch(NoSuchMethodException nsme)
                    errorMessage = nsme.getMessage();
                    return false;
                catch(SecurityException se)
                    errorMessage = se.getMessage();
                    return false;
                catch(IllegalAccessException iae)
                    errorMessage = iae.getMessage();
                return false;
            return true;
        private static Object locateBrowser()
            if(browser != null)
                return browser;
            switch(jvm)
            case 0: // '\0'
                try
                    Integer finderCreatorCode = (Integer)makeOSType.invoke(null, new Object[] {
                        "MACS"
                    Object aeTarget = aeTargetConstructor.newInstance(new Object[] {
                        finderCreatorCode
                    Integer gurlType = (Integer)makeOSType.invoke(null, new Object[] {
                        "GURL"
                    Object appleEvent = appleEventConstructor.newInstance(new Object[] {
                        gurlType, gurlType, aeTarget, kAutoGenerateReturnID, kAnyTransactionID
                    return appleEvent;
                catch(IllegalAccessException iae)
                    browser = null;
                    errorMessage = iae.getMessage();
                    return browser;
                catch(InstantiationException ie)
                    browser = null;
                    errorMessage = ie.getMessage();
                    return browser;
                catch(InvocationTargetException ite)
                    browser = null;
                    errorMessage = ite.getMessage();
                    return browser;
            case 1: // '\001'
                File systemFolder;
                try
                    systemFolder = (File)findFolder.invoke(null, new Object[] {
                        kSystemFolderType
                catch(IllegalArgumentException iare)
                    browser = null;
                    errorMessage = iare.getMessage();
                    return browser;
                catch(IllegalAccessException iae)
                    browser = null;
                    errorMessage = iae.getMessage();
                    return browser;
                catch(InvocationTargetException ite)
                    browser = null;
                    errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
                    return browser;
                String systemFolderFiles[] = systemFolder.list();
                for(int i = 0; i < systemFolderFiles.length; i++)
                    try
                        File file = new File(systemFolder, systemFolderFiles);
    if(file.isFile())
    Object fileType = getFileType.invoke(null, new Object[] {
    file
    if("FNDR".equals(fileType.toString()))
    browser = file.toString();
    return browser;
    catch(IllegalArgumentException iare)
    browser = browser;
    errorMessage = iare.getMessage();
    return null;
    catch(IllegalAccessException iae)
    browser = null;
    errorMessage = iae.getMessage();
    return browser;
    catch(InvocationTargetException ite)
    browser = null;
    errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
    return browser;
    browser = null;
    break;
    case 2: // '\002'
    browser = "cmd.exe";
    break;
    case 3: // '\003'
    browser = "command.com";
    break;
    case -1:
    default:
    browser = "netscape";
    break;
    return browser;
    public static void openURL(String url)
    throws IOException
    if(!loadedWithoutErrors)
    throw new IOException("Exception in finding browser: " + errorMessage);
    Object browser = locateBrowser();
    if(browser == null)
    throw new IOException("Unable to locate browser: " + errorMessage);
    switch(jvm)
    case 0: // '\0'
    Object aeDesc = null;
    try
    try
    aeDesc = aeDescConstructor.newInstance(new Object[] {
    url
    putParameter.invoke(browser, new Object[] {
    keyDirectObject, aeDesc
    sendNoReply.invoke(browser, new Object[0]);
    catch(InvocationTargetException ite)
    throw new IOException("InvocationTargetException while creating AEDesc: " + ite.getMessage());
    catch(IllegalAccessException iae)
    throw new IOException("IllegalAccessException while building AppleEvent: " + iae.getMessage());
    catch(InstantiationException ie)
    throw new IOException("InstantiationException while creating AEDesc: " + ie.getMessage());
    break;
    finally
    aeDesc = null;
    browser = null;
    case 1: // '\001'
    Runtime.getRuntime().exec(new String[] {
    (String)browser, url
    break;
    case 2: // '\002'
    case 3: // '\003'
    Runtime.getRuntime().exec(new String[] {
    (String)browser, "/c", "start", url
    break;
    case -1:
    Process process = Runtime.getRuntime().exec((String)browser + " -remote 'openURL(" + url + ")'");
    try
    int exitCode = process.waitFor();
    if(exitCode != 0)
    Runtime.getRuntime().exec(new String[] {
    (String)browser, url
    catch(InterruptedException ie)
    throw new IOException("InterruptedException while launching browser: " + ie.getMessage());
    break;
    default:
    Runtime.getRuntime().exec(new String[] {
    (String)browser, url
    break;
    static
    loadedWithoutErrors = true;
    String osName = System.getProperty("os.name");
    if("Mac OS".equals(osName))
    String mrjVersion = System.getProperty("mrj.version");
    String majorMRJVersion = mrjVersion.substring(0, 3);
    try
    double version = Double.valueOf(majorMRJVersion).doubleValue();
    if(version == 2D)
    jvm = 0;
    } else
    if(version >= 2.1000000000000001D)
    jvm = 1;
    } else
    loadedWithoutErrors = false;
    errorMessage = "Unsupported MRJ version: " + version;
    catch(NumberFormatException numberformatexception)
    loadedWithoutErrors = false;
    errorMessage = "Invalid MRJ version: " + mrjVersion;
    } else
    if(osName.startsWith("Windows"))
    if(osName.indexOf("9") != -1)
    jvm = 3;
    } else
    jvm = 2;
    } else
    jvm = -1;
    if(loadedWithoutErrors)
    loadedWithoutErrors = loadClasses();
    suck my balls

  • Making Opera Mini The Default Browser..

    As the title sudjest is there such a way to make this the default browser? I looked in the settingd but only found hotspot and the main bb browser?????
    Don't forget to check your cinch!

    Hoping this link will work; if it does, vote for it...to get YOUR wish come true (AND TELL YOUR FRIENDS to vote for it also, aight)!!!
    http://productideas.appspot.com/#8/e=cf (THE Web Browsing topic/LINK@LEFT!)
    I went ahead and above link didn't work unless the orig poster logged in and I Googled it but that also didn't work ( http://google.com/search?num=100&safe=off&q=productideas.appspot.com+clicking+any+link+in+google+sea... ), so best thing i can think of is give you this answer i got here:
    http://supportforums.blackberry.com/t5/BlackBerry-Curve-BlackBerry-8900/setup-emails-through-web-UNl...

Maybe you are looking for