Is it possible to run Chrome as an external tool on Eclipse 3.6 on Mac OS X? - eclipse

I'm trying to set up Chrome to run as an external tool in Eclipse on the Mac. I've entered the path to Chrome as the Location variable:
"/Applications/Chrome.app/Contents/MacOS/Google\ Chrome"
I've got some arguments to pass in to Chrome, but that's not so important - I can't seem to get it started from Eclipse as an External Tool at all. The "Run" button is greyed out, and the configuration doesn't show up on the External Tools run menu once I save it. What am I doing wrong/missing?
UPDATED:
Attempting to use the "open" command ala Running external tools in Eclipse on Mac OS X appears to simply switch to a running instance of Chrome, instead of run chrome with me command line arguments.
I've tried location:
/usr/bin/open
Arguments:
-a "/Applications/Chrome.app" --args "localhost"
and Chrome does not open localhost - instead it simply switches to an existing open window with Chrome in it.

Does this similar SO post help you?
Running external tools in Eclipse on Mac OS X

Related

Live Server does not open in Chrome on Windows 11 and WSL2

I am working in WSL2 on Windows 11 trying to run an index.js file with Live Server. Whenever I open Live Server it seems that I can only do so when I use Microsoft Edge. This seems to add another layer of problems because the JavaScript does not seem to be working as I would expect. For example, if I click a button element I don't see any animations to signify a "click".
I have checked that "liveServer.settings.CustomBrowser": "chrome" is indeed reflectin Chrome in the VS Code settings, but when this is the case there are no windows that pop up at all. The only thing that I see trigger is a notification that tells me that the server is active on Port 5000, just no window popping up to demonstrate that. Ideally I would like to try and open Live Server with Chrome, but if this isn't possible in Windows 11 then is there a way to make JavaScript behave in Microsoft Edge?
I've the same configuration and the same issue. I've raised the issue #2445 in Github.
A workaround solution is to call directly your chrome program installed under windows to your liveserver setting.
check that chrome is well installed on W10 or W11. You can test it by opening a command line and running "start chrome", then chrome browser must open.
look for chrome' installed directory. You can use this command to find it: sudo find /mnt/c/ -type f -iname chrome.exe 2>&1 | grep -v "Permission denied". For me this it's here:mnt/c/Program Files/Google/Chrome/Application.chrome.exe.
Now change liveserver setting on your settings.json file:
{
"liveServer.settings.AdvanceCustomBrowserCmdLine": "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe --remote-debugging-port=9222",
}
Now chrome should start when you run liverserver.
Hope this help

How to get NetBeans 12.0 to launch on Mac (MAC OS 11.0 beta / Big Sur)

On Mac (Big Sur) when I click on the Netbeans 12 icon in the doc it bounces briefly then fails to launch Netbeans.
The answer helped me launch Netbeans from the terminal. I added this change to make my dock icon launch Netbeans like before.
I changed the Netbeans config file to make it launch with the Java path:
Like the previous post indicates find your JDK path with this command in the Terminal
/usr/libexec/java_home -v '1.7*'
Now add this path to the Netbeans conf file. To do this:
right click on the Netbeans icon in the dock and select Open in Finder
in the smaller icon it shows right click again and select Show sources
find the netbeans.conf file in folder Resources/NetBeans/netbeans/etc/netbeans.conf
open this netbeans.conf file with a TextEditor or similar and find the line
#netbeans_jdkhome="/path/to/jdk"
Uncomment this line and change it for your path (the one you found in point 1)
something like
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home"
Save the netbeans.conf file and try and launch from the Dock icon
If you right click on the icon in the dock --> Options --> Show in Finder the operating system will show you where 'Apache Netbeans 12.0' is located.
Highlight 'Apache Netbeans 12.0' then right-click and choose 'Show Package Contents', then you can find a shortcut that launches Netbeans (Contents/MacOS/netbeans).
If you double-click to launch netbeans you'll be presented with the following reason why it fails to load.
/Applications/NetBeans/Apache\ NetBeans\ 12.0.app/Contents/Resources/NetBeans/netbeans/bin/netbeans ; exit;
rob#Robs-MBP-2015 ~ % /Applications/NetBeans/Apache\ NetBeans\ 12.0.app/Contents/Resources/NetBeans/netbeans/bin/netbeans ; exit;
The operation couldn’t be completed. Unable to locate a Java Runtime that supports (null).
Please visit http://www.java.com for information on installing Java.
Cannot find java. Please use the --jdkhome switch.
Credit goes to How can I change Mac OS's default Java VM returned from /usr/libexec/java_home for providing the following step to determine what the JDK path is...
/usr/libexec/java_home -v '1.7*'
Then you can type the following (adjust for your path and version required)
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home"
However that didn't seem to do the trick for me (I also tried JDK_HOME), so instead from a Terminal window type the command to launch Netbeans but include the --jdkhome to your Java home folder, e.g.
/Applications/NetBeans/Apache\ NetBeans\ 12.0.app/Contents/Resources/NetBeans/netbeans/bin/netbeans --jdkhome /Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home
Now I have Netbeans launching again. I'm not quite sure why the JAVA_HOME doesn't resolve this, but hopefully in the meantime anyone unable to launch Netbeans can at least use this workaround.
I've also found this How to run a shell script in OS X by double-clicking? useful to ensure I can double-click on the shell script to run it from a shortcut on my desktop.
For some reason, some Netbeans versions for Mac OS do not detect the JDK contained in JRE. For proper installation and running the application,you must have Java for Mac OS installed previously.
https://www.java.com/es/download/
I had the same issue after upgrading to macOS Big Sur from Mojave.
Before running commands in terminal, you could just try to reinstall Java for Mac OS X :
https://www.java.com/en/download/
It solves my issue. I am now able to launch NetBeans 12.1

Command in parcel.js --open 'google chrome' does not work on Windows, only works on MacOS

I use parcel.js to set up my project. This command --open 'google chrome' does not work on Windows, only works on MacOS. The error is: Windows cannot find 'google'. Make sure you typed the name correctly, and then try again.
The browser value passed to --open [browser] is platform-dependent:
Windows: chrome
Linux: google-chrome
MacOS: google chrome
Parcel uses the opn package to start the browser. From the opn documentation:
Type: string | string[]
Specify the app to open the target with, or an array with the app
and app arguments.
The app name is platform dependent. Don't hard code it in reusable
modules. For example, Chrome is google chrome on macOS,
google-chrome on Linux and chrome on Windows.
You may also pass in the app's full path. For example on WSL, this can
be /mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe
for the Windows installation of Chrome.

How can I set Chrome as default external browser in Eclipse for Mac?

I think that question is self-explained :-)
When I browse to Application eclipse send me an error.
The simplest way to get Eclipse to recognize Chrome as the default system browser is :
Open Safari.
Go to menu Safari > Preferences > General.
Change 'Default web browser' to Safari.
Close the Preferences dialog.
Re-open the Preferences dialog.
Change 'Default web browser' to Chrome.
Close the Preferences dialog.
This solution is more general as it applies to any application which chooses the incorrect system browser. (thanks to Kelvin Lawrence at IBM)
I am using Eclipse 4.2.0 on an iMac with OSX Mountain Lion. This also works for Eclipse Kepler on Mountain Lion.
I posted the answer on another question like this on stackoverflow, so here it goes:
I found the solution in a blog's post that doesn't exist anymore, it involves configuring the Location to be '/usr/bin/open' and the parameter is '%URL%'.
You need to make sure that google chrome is your default browser and it will work properly. This is the only method that worked for me on OSX Lion.
I solved this by calling /usr/bin/open -a "/Applications/Google Chrome.app" <url>
rubdottocom almost got it. The problem is, that the path contains spaces. If you write a new shell script with the following content:
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' $1
Eclipse can launch a new Chrome instance with it. Sadly, this way it is not possible to open a new tab in an already running instance, as the script exits with the following error message:
[21043:2307:292361872340725:ERROR:process_singleton_mac.cc(102)]
Unable to obtain profile lock.
Ooops! I find the answer here: Is there a way to add Google Chrome as an external web browser in Flash Builder Standalone for Mac?
The exact location is:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
It's annoying that you can't enter inside to an "Application folder" (AppName.app) through Finder :-S
Oh Wait! It's not working >_< Safari is opened
you can also try to fix that from eclipse at the menu bar: windows->preferences->general->web browser-> select the radio, Use external web browser and choose your default browser from there. that simple.
Here's a helpful visual showing the /usr/bin/open techinque:
In Finder, right click on Google Chrome.app, select Show Package Contents and browse down to Contents/Mac OS and drag Google Chrome to the Location in Eclipse's Edit External Web Browser dialog box. Enter -url %URL% in the field Parameters. This worked for me on Eclipse Indigo on MacOS 10.7, at least when Chrome was not started before...
My method to set Chrome as a default browser in eclipse is:
Go to Window >> Web browser and then select Chrome.

Is there a way to add Google Chrome as an external web browser in Flash Builder Standalone for Mac?

It currently seems impossible to add Google Chrome as an external web browser in Flash Builder Standalone for Mac. In this context, Eclipse only cares about "Unix executables" and not .app files.
For example, the path to Firefox on a Mac is: /Applications/Firefox.app/Contents/MacOS/firefox-bin
which is only found by right-clicking and choosing 'Show Package Contents' on Firefox.app in your Applications directory.
If you try to add Google Chrome as a new external web browser, you'll have to repeat this process to navigate to /Applications/Google Chrome.app/Contents/MacOS where the 'Google Chrome' Unix exxecutable resides.
The problem is that space in the name. If you attempt to click OK in Eclipse, you'll get an error preventing you from continuing:
The location value is not a valid path
name
Are there any workarounds for this so I can use Chrome as my development browser only? I did some searching and all I could come up with was this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=297273
UPDATE: A kind and savvy Flash Builder engineer gave me a helpful tip. Note that you'll need to show hidden files in Mac, by opening Terminal and entering the following command:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
Press Return to relaunch Finder. Once hidden files are shown, "You’ll find what you need in [YOUR WORKSPACE]/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.browser.prefs.
There’s a 'browsers' property there that defines XML for defining Eclipse’s web browsers. Add a new browser location and name and restart Flash Builder."
In this case you'd add:
<external location\="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" name\="Google Chrome"/>\n
I can confirm that this works. Hopefully we won't have to resort to this kind of hackery on the next go around.
You can do this from the UI in FB 4.5 - However, you need this exact path (unquoted and unescaped) in Preferences->Web Browser. Select "Use External Browser" and add the line below as the location (You may not need the 'name\="Google Chrome" bit, but looks like it worked all in one line for me):
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" name\="Google Chrome
You could create an executable here: /usr/local/bin/chrome with these contents:
#!/bin/sh
open -a 'Google Chrome' $1 &
And then ensure Chrome's Preferences settings for "Web Browser" are this for external web browser "Google Chrome":
Name: Google Chrome
Location: /usr/local/bin/chrome
Parameters: %URL%
Update
As of Eclipse 4.3.1, the script approach (below) no longer works, but the simpler option of simply selecting "Google Chrome.app" as an external browser (using Eclipse UI) is fixed.
Old (obsolete) answer
My workaround was to create a shell script that opens Chrome (see below), and point Eclipse to this script. In this way Chrome is opened with 2 tabs - the home page and the requested page - but this was good enough for me.
#! /bin/sh
open /Applications/Google\ Chrome.app $*
You need the path to the Unix Executable file of Google Chrome.
How to:
in Finder, right click Google Chrome.app "Show Package Content".
Navigate down to Content/MacOS
cmd + i and copy the path to the Unix Executable File
In Eclipse Preferences Web Browser / Location, "brows.."
Paste in the path to the Unix Executable.
The path, something like: /Applications/Google Chrome.app/Contents/MacOS
Location: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Parameters: -sandbox
The simplest way to get Flash Builder Standalone for Mac to recognize Chrome as the default system browser is
Open Safari
Go to menu Safari > Preference > General
Change 'Default web browser' : Safari
Change 'Default web browser' : Chrome
Close Safari
This solution is more general as it applies to any application which chooses the incorrect system browser. (thanks to Kelvin Lawrence at IBM)
For me worked with the following configuration:
Location: /usr/bin/open
Parameters: -a "Google Chrome.app" %URL%
I found the solution in a blog's post that doesn't exist anymore, it involves configuring the Location to be /usr/bin/open and the parameter is %URL%.
You need to make sure that google chrome is your default browser and it will work properly. This is the only method that worked for me on OSX Lion.
/Applications/Google\ Chrome.app/Contents/MacOS
escape the space in the path to the google chrome executable. OS X only cares about unix executables, because its posix based as well, it doesn't actually have much to do with eclipse.