running eclipse from terminal in mac os x - eclipse

I've been trying to run eclipse from my mac os x terminal and I'm getting the error that no such eclipse command is found. I added the directory to my PATH variable and I'm able to run this just fine on linux, just not on mac osx.
Anyone know why this is?

Eclipse is a Mac Application (like Mail.app) rather than a simple executable so you open it from Terminal using the open command:
open /Applications/eclipse.app
This is assuming you are using Eclipse Mars or later, earlier versions of Eclipse have a different path.

I have a bin folder at my user root folder. This folder is added to my PATH env variable in my .bash_profile
Then I have an ~/bin/eclipse file. this file is executable (chmod +x ~/bin/eclipse)
it contains
open /Path/To/Eclipse.app
Hope this help

Related

Not able to open VS Code from Terminal in my MacBook BigSur11.3.1

Good day community. I have installed VS Code in my MacBook Air M1 chip running on BigSur 11.3.1 but whenever I set the code command in PATH (using Command+Shift+P) it only appears to be working for current session and doesn't work if I restart VSCode. I have to set the code command in PATH again. Please help me in configuring code command permanently so that i can open VSCode from any directory whenever I want. Thanks
I think I have got the solution. After installing VSCode in your Mac (which will be in download folder) move VS Studio Code.app file to Application Folder and then again install the code command in PATH from VSCode(using Command+Shift+P) and thats it.

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

How to call VS Code Editor from terminal / command line

The question says it all.
How can I open VS Code editor from
windows cmd
linux and mac terminal
e.g. for notepad++ I write
> start notepad++ test.txt
By the way, the editor is awesome (cross-platform)! Thank you Nadella!
You can download it from microsoft
To open a file or directory use the command:
code /path/to/file/or/directory/you/want/to/open
For macOS users, it needs to be installed manually:
Launch VS Code.
Command + Shift + P to open the Command Palette.
Type shell command, to find the Shell Command: Install 'code' command in PATH and select to install it.
Restart your terminal.
Per the docs:
Mac OS X
Download Visual Studio Code for Mac OS X.
Double-click on VSCode-osx.zip to expand the contents.
Drag Visual Studio Code.app to the Applications folder, making it available in the Launchpad.
Add VS Code to your Dock by right-clicking on the icon and choosing Options, Keep in Dock.
Tip: If you want to run VS Code from the terminal, append the following to your ~/.bash_profile file (~/.zshrc in case you use zsh).
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
Now, you can simply type code . in any folder to start editing files
in that folder.
Tip: You can also add it to VS Code Insiders build by changing "com.microsoft.VSCodeInsiders". Also if you don't to type the whole word code, just change it to c.
Linux
Download Visual Studio Code for Linux.
Make a new folder and extract VSCode-linux-x64.zip inside that folder.
Double click on Code to run Visual Studio Code.
Tip: If you want to run VS Code from the terminal, create the following link substituting /path/to/vscode/Code with the absolute
path to the Code executable
sudo ln -s /path/to/vscode/Code /usr/local/bin/code
Now, you can simply type code . in any folder to start editing files
in that folder.
VS Code is a must have code editor for 2018
For Windows 10 users a lot is possible, the same way the Mac OS users type code . .
Look for you VS Code \bin folder path e.g C:\Program Files\Microsoft VS Code\bin . The bin folder includes a file called code.cmd .
If you are not sure about what is your path, type where code.cmd, and then, copy it without the \code.cmd after the ...\bin.
Follow the steps below and be proud of the OS you use.
Search for "Advanced System Setting" from Start.
Click on Environment Variables.
On System Variables choose "path" from Variable tab and click on Edit.
Click on New on the right side of the popup window.
Copy your path from the Explorer's breadcrumb path and paste it into the new opened path in step 4, example:- C:\Program Files\Microsoft VS Code\bin.
Click Ok on all the open windows to confirm changes and restart your cmd .
Go to your cmd and navigate to you working directory on server and type code . .
C:>cd wamp64\www\react-app> code . to open with VS Code on Windows.
Visual Studio Code also includes a command prompt (terminal) window and you can open one or more of them with:
Ctrl + ` on your keyboard.
Hope this helps some one like it did to many of us.
You can also run VS Code from the terminal by typing code after adding it to the path:
Launch VS Code.
Open the Command Palette (⇧⌘P) and type shell command to find the Shell Command: Install code command in PATH command.
Mac shell commands
Restart the terminal for the new $PATH value to take effect. You'll be able to type code . in any folder to start editing files in that folder.
For VS Code Insiders Windows users (vs code doc):
Add the directory "C:\Program Files (x86)\Microsoft VS Code Insiders\bin"
at %PATH% environmental variable.
then go to the folder that you want to open with vs code and type:
code-insders .
Sometimes setting path from VS Code command palette does not work
Instead manually add your VS Code to your path:
Run in terminal
sudo nano /etc/paths
Go to the bottom of the file, and enter the path you wish to add
Hit control-x to quit. Enter “Y” to save the modified buffer.
Restart your terminal and to test echo $PATH. You should something similar
~ echo $PATH /Users/shashank/.nvm/versions/node/v8.9.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin
Next time, you navigate to your project folder from terminal
Enter:
code .
or
code /path/to/project
Source
In the case of Linux and Mac, you want to navigate to the directory that you extracted the VSCode files using the 'cd' command. For example:
cd ~/Downloads/VSCode
Then you start the application by running..
./Code
'Code' being the name of the executable.
If you have root access on the machine, you can configure the system to allow you to start VSCode from anywhere by linking it to /usr/bin, where links to executables are often stored.
sudo ln -s /path/to/VSCode/folder/Code /usr/bin/Code
You can now launch VSCode from anywhere by typing:
Code
For command line heads you can also run
sudo ln -s "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code
this will do the exact same thing as the Shell Command: Install 'code' command in PATH command feature in VSCode.
When installing on Windows, you will be prompted to add VS Code to your PATH.
I was trying to figure out how to open files with VS Code from the command line and I already had the capability - I just forgot I had already added it. You might already have it installed - check by navigating to a folder you want to open and running the command code . to open that folder.
In linux if you use code . it will open VS Code in the folder the terminal was in.
Using code . Filename.cs it will open in folder and open said file.
For linux Debian the below can be done
$ export PATH=$PATH:/usr/share/code
Then run it
$ code
$ code file.py
$ code workingdir
Open command line and type:
cd your_folder_path
code.cmd .
or
code.cmd your_folder_path
It will open your folder in Visual Studio Code.
Make Sure, you are inside the correct folder after executing "cd your_folder_path" command.
On Windows you can add the following path to the system environment variables.
C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin
This works for Windows:
CMD> start vscode://file/o:/git/libzmq/builds/msvc/vs2017/libzmq.sln
But if the filepath has spaces, normally one would add double quotes around it, like this:
CMD> start "vscode://file/o:/git/lib zmq/builds/msvc/vs2017/libzmq.sln"
But this messes up with start, which can take a double-quoted title, so it will create a window with this name as the title and not open the project.
CMD> start "title" "vscode://file/o:/git/lib zmq/builds/msvc/vs2017/libzmq.sln"
typing "code" in dos command prompt worked for me
On Ubuntu the flatpak version seemed broken. I uninstalled it and downloaded the deb package right from Microsoft.
I use the following command to load a project quickly (in linux)
cd into the project cd /project
run command code pwd
similar steps can be used in other Os too.
In linux terminal you can just type:
$ code run
Windows:
Add code CLI path in a system environment variable.
in windows default code cli path is (username is you pc username)C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin
Then you can check it like this by taking your project folder and open new cmd and type code .
Step 1: create a .bat file with the name you want e.g vscode.bat
Step 2: Write your path to Visual Studio Code
Step 3: Save it in C:\Windows\System32 directory
**
C:
cd Users\Bino\AppData\Local\Programs\Microsoft VS Code
Code.exe**
Step 4: You can call visual studio code from any where by typing "vscode" which is the name of your bat file
This will work. This is your directory name "Directory_Name"
sudo code --user-data-dir="Directory_Name"
Other easyway to do it on mac is :go to Command Palette[ Shift ⇧+ Command (⌘)+P] and type :Shell Command: Install 'code' command in PATH
once installed: Shell command 'code' successfully installed in PATH.
Then you can use code from the terminal as well.
If you install VS CODE using snap. You will need to add /snap/bin in your PATH environment variable.
so - open your .bashrc or .zshrc
and add :/snap/bin in your PATH environment variable
reload terminal,
and than code comand will start it
A simple way is to go to your Project where you want to open it and type
code.cmd D:\PathTo\yourProject\MyProject
That's it. It will open your project in Visual Studio Code.
Delete old virtual environment and create a fresh virtual environment.
In a way I am reticent to add to the long list of answers. However, I searched this page for the word "portable" and came up empty. (And I did a full Stack Overflow search and also found nothing.) So I want to add this very specific answer for potential future searchers.
This answer is for if you installed VS Code in Portable Mode on Windows 10.
"Portable Mode" refers to what is described on the official VS Code web pages, which as of 21 January 2021 are found here: https://code.visualstudio.com. It does not mean the Visual Studio Code Portable project started/run by Gareth Flowers, or any similar project. (I am not saying anything bad about this or other projects - I have neither used nor evaluated.) If you are using one of those projects, you need to check with that project documentation/community - although this might work.
"Installing" VS Code in Portable Mode is downloading a .zip archive and extracting it locally wherever you want your VS Code "installation" to live. There is no actual installation or setup that is run, so there is no automatic adding of the code command to your PATH.
Answer
After extracting the Portable Mode VS Code files to the location of your choice, there should be a bin folder in that location. Copy the full path of that bin folder and add it to your System or User (your choice) PATH variable.
You should then be able to use the code command from PowerShell or CMD.
In linux you need to check first what is the name you your vscode binary file
When you get the binary file name check where it is by using this command :
whereis your_file_name
Go to the / (root) and go to bin and rename file with any name what you want to call it.
To rename : mv your_file_name your_changed_name
Now you can access vscode from any where in terminal
This works on Debian based Os definitely

How to run eclipse on Ubuntu 13.10

I've copied my eclipse from my office laptop to home laptop , both of which are running on Ubuntu 13.10. Well the problem is when I start the eclipse on my home laptop it gives me an error :
There is no application installed for “executable” files.
Do you want to search for an application to open this file
I don't get it ,is it an executable file that i'm starting and i need tools like WINE for this or what type of file is it ,to be clear i want to know what kind of file ubuntu has in contrast to windows < .exe > executable files
Try to right+click on eclipse icon -> properties .. go to permission tab.
Then make sure that the check box "Allow executing file as program" is checked.

How to open a directory in PHPStorm or IntelliJ (or any JetBrains IDE) from the command line?

Is there a way to open up a directory in PHPStorm or an equivalent Jetbrains IDE from the command line? For example, in Textmate, I would just do:
mate .
to open the working directory.
Use Tools -> Create command line launcher and then you can execute pstorm .
Here's how I got IntelliJ Command-line launcher to work with MAC Sierra
(v 10.12.2).
This works with IntelliJ IDEA:
Tools -> Create Command-line Launcher..
Replace 'idea' in the string '/usr/local/bin/idea' with whatever you wish.
(I use 'ij'), so for me its '/usr/local/bin/ij'.
Open your terminal
Navigate to the project/folder you want to open.
Write the chars you wrote after 'bin/' and then '.'
For me its ij .
On OS X: open -a 'phpstorm.app' file-or-folder
For PhpStorm on Windows:
Add the PHPStorm's installation path to the Environment Variables "PATH" variable,
Scroll to the project folder in the command line
Issue the command phpstorm64.exe . if it is 64 bit machine or phpstorm.exe . for 32 bit machine.
I presume the same strategy will work for IntelliJ as well.
Here is the menu entry for v2016.2:
After that you can open folders with pstorm {myfolder}.
Hope it helps.
If you see this message
for Intellij 2019.+ please check this answer. It uses Jetbrains toolbox.
You just need to set path in Generate shell scripts option to /usr/local/bin/ in Jetbrains toolbox
https://stackoverflow.com/a/56050914
and then just run idea .
or pycharm . , phpstorm . etc.
On MacOs
edit ~./bash_profile
add this line
alias pst="open -a 'phpstorm.app'"
Source it
source ~./bash_profile
Now you can open phpstorm in a directory with
pst .
If you are using the JetBrains toolbox, you can configure the shell script for each IDE by going to
settings of the IDE in the toolbox (three dots > settings)
configuration
shell script name
Set it to any text you want
So the method Tools > Create command line launcher... no longer exists in OSX Intellij 2019.1
You can manually make this change via:
vim /usr/local/bin/idea
Change these lines appropriately from old version to new. should be something like this:
RUN_PATH = u'/Users/blahblah/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/191.6183.87/IntelliJ IDEA.app'
CONFIG_PATH = u'/Users/blahblah/Library/Preferences/IntelliJIdea2019.1'
SYSTEM_PATH = u'/Users/blahblah/Library/Caches/IntelliJIdea2019.1'
If you don't know the new path then run something like:
ls /Users/blahblah/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U
or manually navigate via finder, then drag/drop the IntelliJ IDEA.app icon from finder into your cli to copy across the full path.
I`m using JetBrains Toolbox to get the latest updates. And the only solution which worked for me (macOS) is:
Add the following function into ~/.bash_profile
phpstorm-open-current-path() {
PHP_STORM_CH=~/Library/Application\ Support/JetBrains/Toolbox/apps/PhpStorm/ch-0
PHP_STORM_LATEST_VERSION=$(ls -rA1 "${PHP_STORM_CH}" | head -1)
open -a "${PHP_STORM_CH}/${PHP_STORM_LATEST_VERSION}/PhpStorm.app"
}
Reload the changes by opening a new terminal, or running the following command in the current one:
. ~/.bash_profile
Use it:
cd <PROJECT_DIR>
phpstorm-open-current-path
It should be pretty easy to adopt it for any other IDE/OS.
1- add the phpstorm installation path to the path system variable
2- in project folder in address bar type "cmd".
3- in cmd type "phpstorm64 .".