Open a JavaScript in Google Chrome on a Mac computer

My question is simple:
How can I open a JavaScript file with Google Chrome on a Mac computer using Java?
This is my code so far:
JOptionPane.showMessageDialog(null, "Please browse to Google Chrome!");
                            JFileChooser fc = new JFileChooser();
                            FileFilter ff = new FileFilter() {
                                public boolean accept(File pathname) {
                                    if (pathname.isDirectory()) {
                                        return true;
                                    if (pathname.getName().toLowerCase().equals("chrome.exe") || pathname.getName().toLowerCase().equals("chrome.app")) {
                                        return true;
                                    return false;
                                @Override
                                public String getDescription() {
                                    return "chrome.exe; chrome.app";
                            fc.setFileFilter(ff);
                            int returnVal = fc.showOpenDialog(null);
                            if (returnVal == JFileChooser.APPROVE_OPTION) {
                                try {
                                    Runtime.getRuntime().exec("open " + fc.getSelectedFile().toURI() + " " + f.toURI());
                                } catch (Exception exxxx) {
                                    JOptionPane.showMessageDialog(null, "Unknown exception occurred! It's: " + exxxx.toString() + "\n" + "fc.getSelectedFile().toURI()");
                            }I have little to no Mac knowledge, but this code opens Google Chrome, Safari and Finder at once...

Okay I have figured the exact mac command needed to open a file with a custom program, however, if I use the exact same command in Java, nothing happens, Chrome doesn't open, no errors, nothing...
I am using this code:
try {
     Process process = Runtime.getRuntime().exec("open -a \"Google Chrome\" /Users/noskill/Desktop/1.0.user.js");
} catch (Exception p) {
     System.out.println("Even this doesn't happen!");
}Which is weird because whenever I use the exact same string in Mac Terminal, Google Chrome starts and loads it...
So my question now is: How to run a Mac command in Java?
Edited by: The_Pointer on Sep 15, 2010 2:20 PM

Similar Messages

  • I can open Safari, Finder and Google Chrome ( my default browser) but they do not display on my iMac.  Evidently they are minimized somewhere but I can't figure out how to maximize them.  This has been a problem ever since I down loaded Mavericks.

    When I open Safari, Finder or Google Chrome (my default browser) they do not displayanywhere on my iMac. 
    Tthey are minimized somewhere but  how can to maximize them. 
    I can't say for sure this is related to Mavericks but the problem began shortly after dowloading Mavs.
    Any suggested fix?

    Hope the following helps to make things clearer.
    When I left click Safari or Google Chrome in my Dock, neither expands.  When I then right click wither one in teh Dock, a dialog box pops up  which gives me the option to close them, which implies that they are in fact open.
    In other words, when I left click on Safari or Chrome in my Dock, nothing visibly changes on my Desktop.  Indeed, neither Safari not Chrome are listed as the active window in the menu bar.  If I do the same with Finder, at least Finder shows up as active in the menu bar but that's all.  Finder itsef is not accessible and so I cannot  use it.
    On the other hand, I ahve no problem opening up Paralles 9 for Mac to access Windows/Explorer which is what I have done to send this note to teh Apple Communities Forum.  Nor do I ahve a problem opening up any of my other programssuch as Office for Mac, etc.
    I suspect this may be mavericks related but can't say for sure.
    Any help would be much appreciated.  Thanks.

  • I can not open my email in hotmail. I can open hotmail, see the fact that I have emails but it won't allow me to open them. this just started 2 days ago and has always worked before . I can open using IE and Google Chrome

    I found I could not open my email within hotmail. Hotmail itself works in IE and Google Chrome so I know it is FF. I can open the account but not individual emails nor can I delete junk mail. Nothing within the hotmail window seems to work.

    This issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Problem with opening PDF files in Google Chrome browser

    We have a web page displaying links to dynamically generated PDF files located on the internal repository. This files are not just text PDF files but PDF forms created using XFA technology. This means that they must be opened and filled only in Adobe Reader and not in Foxit Reader or browser's built-in PDF viewer.
    Now, the problem is that a Google Chrome browser opens any PDF file using its own PDF viewer. And I want to force this browser to open PDF files in Adobe Reader.
    How can I achieve this without disabling 'Chrome PDF Viewer' plugin since I can't do this for all users of our web site?
    Any help or advice would be greatly appreciated.
    P.S. We use LiveCycle ES3.

    Each user would have to set each browser individually.
    Note: I don't think it's possible to set the default PDF viewer with code for every user who visits the site.
    See the following link to enable Adobe Reader as the default PDF viewer in different browsers:
    http://helpx.adobe.com/acrobat/using/display-pdf-browser-acrobat-xi.html
    Note: Not all PDF viewer browser plug-ins support PDF submissions, and most 3rd party viewers may not support forms created with LiveCycle or forms with Extended Reader Rights enabled.

  • How do I open a PDF in Google Chrome?

    How can I get adobe reader to open a tax form I need to print?  Help!

    I use Google Chrome on my PC.  The form is online on the Wisconsin Department of Revenue forms.  When I select the form I want I get a message which says I need to update Adobe to open the form.  I did update to Acrobate Reader DC but still get the same message.

  • Firefox will not open at all. Google Chrome main browser.

    Google Chrome my main web browser with Comcast as home page.
    Now Firefox will not open at all. What do I do. Delete Firefox and reinstall is what I think?

    Yes, i would try reinstalling Firefox first.
    A few other basic trouble shooting things you can try is this:
    Run all Windows Updates, install all needed service packs, etc.
    Update your graphics driver (Firefox uses your graphics card for some rendering, and an out of date graphics card driver can cause problems. [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    Update all your plugins (Flash, Java, etc.): [http://www.mozilla.org/plugincheck/ http://www.mozilla.org/plugincheck/].
    Download and Install MalwareBytes Anti-Malware, run a full Scan. [http://www.malwarebytes.org/ http://www.malwarebytes.org/]. This helps check that there are no viruses on your computer causing issues. You can uninstall this program after you clean off any infections.

  • Firefox will not open today, it hangs, google chrome is fine

    Firefox launches with telegraph.co.uk as default. No problems before. Today it hangs and even trying to delete telegraph.co.uk doesn't work , at least one second to delete one character, then if I type in igindex.co.uk and press return, it just hangs. Google chrome is working fine.

    Clear the cache and the cookies from sites that cause problems.
    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    *http://kb.mozillazine.org/Error_loading_websites

  • Google chrome on a mac help

    i have a mac with snow leapord version 10.6.8 managed to get a new version of google chrome to install but the older copy  will not unistall  be cause it keeps saying google chrome helper is runnig but i am not using it and it is slowing down mac ..
    can anybody help pleeeease

    I'm a bit confused. Is the goal to end up with a new version of Chrome or stick with the older one?
    If you want the latest, launch the old version and from the Chrome menu go to About Google Chrome and it should update for you.
    If you need to quit the Google Chrome Helper launch Activity Monitor in Utilities, select Google Chrome Helper in the list of Active processes and then click on the big red 'quit process' button top left of the window.
    Note: you may find there is more than one instance of Google Chrome Helper running.

  • Why does adobe try to force Google Chrome on to my computer and a Google Toolbar! Thats is fasist!

    also why does adobe require so many updates! why can't they get it right the first five hundred time i update it!
    why cant i update or down load with out having to get google tool bar to be spyied on? WTF? And Google Chrome if i wanted Google Chrome i down load it directly!
    Google collecting and storing information is an invasion of privacy! If Adobe is so free thinking and so advanced, ask if we want ******** toolbars downloaded it sucks when you think your down loading something and get a new webpage and toolbars. Dont do business this way. Its arrogant & ignorant

    Adobe never installed anything on my computer I didn't want.  You can always uncheck bundled software that is offered with the standard downloads, or use the offline installers that are not bundled with any 3rd party software.

  • Can't open pdfs; can't save pdfs on my MAC Computer

    Hi   I have problems with my Adobe Reader on my MAC computer…Mac OSX version 10.7.5.  It began when I did update my current Adobe Reader.  Eversince, I always get a window saying "Adobe Reader could not open "_______" because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and was not correctly decoded."
    I couldn't open any pdf file on my desktop.  I also couldn't save a paper as a pdf form but it looks like a notebook file on my desktop…not the normal red pdf file.
    I am not sure how I can correct the problem.

    Hi jcs174,
    If you just want to save a pdf opened in Safari to your machine use the save as option from within the Reader window. Just click on any of the buttons highlighted in below screenshots to Save a pdf at any location on your machine.
    or
    To summarize the issue, if you had opened an Internet PDF in a browser plug-in, you must use the save feature in the plug-in, not the Safari File > PDF Export, or File > Save As...
    Please let us know if this solution works for you and you are able to save and view PDFs files locally.
    Regards,
    Shashi

  • An't open pdfs; can't save pdfs on my MAC Computer

    I have problems with my Adobe Reader on my MAC computer…Mac OS X version 10.10.1. , I always get a window saying "Adobe Reader could not open "_______" because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and was not correctly decoded."
    I couldn't open any pdf file on my desktop.  I also couldn't save a paper as a pdf form .

    Hi moti-b,
    In the screenshot you have attached, on the bottom right hand side, 'When visiting other websites : ' check 'Allow Always' for Adobe Reader. Close Safari app. Open any pdf in Safari again. Check for HUD tab at the bottom of the pdf to ensure that pdf is rendered in Safari via Reader only.
    For Reader the HUD looks like :
    If pdf is rendered using Preview in Safari,HUD
    After chosing 'Always Allow' option,  the pdf should open via Reader and the Save button should work fine as well.
    Regards,
    Ruchika

  • Cannot open docs downloaded in Google Chrome to Word 2013

    Hi! I've been using Office 2013 for a couple of months with no problems. However, I've just found an odd reaction to downloading files.
    When I download a Word attachment in an email (I'm using Chrome Version 23.0.1271.91 m) and then click on the icon to open the document in Word, I get the error box: "Word experienced an error trying to open the file. Try these suggestions...". It opens
    fine on my Apple iPad (!), and as a workaround I've taken to opening it on iPad, copying the text into an email and mailing it to myself, then reformatting in Word on my desktop, using the open document on my iPad as the exemplar.
    Since I do a LOT of cut and paste into other documents for publication this is not exactly a good use of my time!
    Is anyone else having trouble opening email attachments into Word, and is there a solution?
    Thanks! 

    Please try to set IE as your default browser, and check this again.
    Max Meng
    TechNet Community Support

  • Open Crystal Reports for Google Chrome

    I have an application that generates some reports. All reports are loaded by browsers IE and Firefox, but Chrome by Google are
    not loaded. The report starts to load and crashes not displaying anything. I hear there's a mismatch or error because the chrome does not use some kind of active x. Googled something like that but found nothing. Anyone have any info on this type of problem?

    Hello,
    Thank you for your post.
    Based on your description, I am afraid that the issue is out of support of VS General Question forum which mainly discusses
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    I suggest that you can consult your issue directly on SAP Crystal Reports:
    http://scn.sap.com/community/crystal-reports/content?filterID=content~objecttype~objecttype[thread]
      for better solution and support.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • When I click on a link in an email, nothing happens; Firefox used to open the page. I am using a Mac computer, latest OS, and the Mac mail program.

    I have tried quiting Firefox and setting Safari to my default browser. Links open on Safari just fine. When I go back to Firefox as my default, I continue to have the same issue, links will not open in Firefox.

    You can also quit and relaunch Firefox and then
    the link will open in mac mail.

  • I use myway email, Today it will no longer open in firefox. I tried IE and Google chrome and it opens OK, but I prefer firefox. Please help

    I have been having problems with my email, (Myway,) for a few days. Today it would not open at all. I continued to try and got a message saying the pages had been redone and some pages were no longer available . I tried IE and it opened, I then tried Google Chrome it opened alright. I prefer to use Firefox but if I can't access my mail I will have to change browsers for everything..

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

Maybe you are looking for