Install VSCode in a specific folder - visual-studio-code

I just downloaded the Visual Studio Code App from https://code.visualstudio.com/ and when I tried to install it, it simply just installed it by itself, without the option to change the installation path.
I have an external harddrive, which is where I want the IDE to be placed instead of the Local Harddrive. How can I change this?

On the VSCode download page select "System Installer" instead of "User Installer". The System installer will prompt you for the install location.

Full credit to Hans Passant for giving the following working solution as a comment.
The installer does very little beyond copying the files, it just creates some Explorer context menu shortcuts ("Open with Code"). Otherwise following Chromium conventions and copying itself to c:\Users\yourname\AppData\Local\Code\app-0.1.0 so it can update itself without you noticing. Boo. So high odds that simply moving that folder to the other drive works just fine, put it anywhere and create a shortcut to Code.exe. If you still want the context menu entry to work then use Regedit and search for "code\app-0.1.0".

Related

How to change folder that opened by default in VSCode?

I have small problem with VSCode folder, that opened by default.
Problem description: I start new instance of VSCode (trough File->New Window), and then if I choose File->Open Folder it opens dialog with my Windows user folder as starting point (C:\Users\MyUser)
Question: How can I change that folder in settings (if it possible)? So by default it will show as start point for example D:\development\ ?
At the time I write this answer, this is not possible. There are two problems on Windows, and one problem on Mac and Linux:
VS Code does not provide a default path to the file dialog 1. It does remember the last folder that you opened a file in, but that path cannot be used as a default because it is overwritten constantly.
On Windows only, Electron ignores the default path when creating a file dialog if the default path is a directory 2.
An extension also cannot solve this, because extensions are not allowed to modify the File menu 3.
I think the best option at this point is to pin a folder to the Quick Access area in Windows Explorer, as suggested in a comment, or to put an actual shortcut in the user profile folder.
Workspaces and File > Open Recent may also be helpful if you often open the same folders.
Your main problem is that you are unable to open your specific folder in VScode.
To solve that you can simply open the terminal/cmd in that specific window by just typing cmd in your search bar or just by pressing shift+right-click in that folder.
Now your cmd is open and you just have to type "code ." in the cmd and press enter to open the current folder in your VSCode.
In case that code . doesn't work for you then you have to add the Vscode in the environment variables of your windows.
Visual Studio doesn't provide a specific feature to open a specific path. But there is a solution to your problem. You are saying that you want D:\develpment as a default when you open VS Code. You can go to that specific directory or create shortcut to desktop then click right click on that folder and then click on open with code. If you didnot see open with code then reinstall your VS code and check on open with code when you are reinstalling VS Code.
make a shortcut on the desktop for vscode and then modify it and add the folder after the .exe command. This will default open that folder when you double click on it.
Visual Studio Code can be installed in two ways - User setup and System setup. I strongly believe you have User setup installed in your PC. Try re-installing it System-wide. That should probably fix your problem.
For more information: https://code.visualstudio.com/docs/setup/windows#_user-setup-versus-system-setup
PS: A lot more information is needed, you can share a screenshot of the window and elaborate more on it.

Editing WSL config files\code etc with Visual Studio Code, in Windows

I am really enjoying WSL and using it for a lot of stuff these days, including my Ansible workstation, also writing a lot more code in it...
Question: I can see where the WSL file system is:
https://askubuntu.com/questions/759880/where-is-the-ubuntu-file-system-root-directory-in-windows-nt-subsystem-and-vice
All of the docs tell you very clearly to stay away from the Linux file system and not to access it from the Windows instance it is running under. Fine. But! I hate to ask redundant question, but I would dearly, dearly love to be able to use full blown graphical VS Code in Windows in my text editor for WSL. Am i missing a trick somewhere for a way to do this without breaking anything?
Apologies for the non question. Hopefully it is allowed.
In vscode...
You can press the green icon bottom-left
This will open the command palette
Choose "New WSL Window"
Open a folder, you will be able to navigate from ~ to choose location in command palette
Once folder is choosen, you're set to go, vscode will display file tree from opened folder and you can do your thing :)

Some questions about Ubuntu permissions and shortcuts

I just downloaded Eclipse IDE and Netbeans directly from the websites and installed then in my Ubuntu 12.04. I have some questions:
1 - How can I add their shortcuts in the Ubuntu's sidebar?
2 - When I add shortcuts in desktop using the gnome-desktop-item-edit app, I can't have super user permissions to manipulate then, the Netbeans IDE (that uses a script file to start) shows lots of erros telling that some files are read-only. How can I add sudo privileges in a launcher created with gnome-desktop-item-edit?
Sorry by my poor english.
As far as question #1, first, open the program. Find its icon on the side bar, and right-click it, then select “Keep in Launcher.”
As for #2, in Ubuntu, you can edit the item to run with gksudo COMMAND, but that's extremely unwise (running anything with elevated privileges on the desktop. You should probably instead fix the permissions of the relevant files (right-click on the file, and give yourself permission)
Well, after some days trying to find the better solution for my problem, I think that the better solution is first, Download Eclipse and/or NetBeans IDE from the Ubuntu Software Center and after:
For NetBeans:
Use the IDE's plugin's manager to download the needed ones, and make (if you want) an IDE update process.
For Eclipse:
After download, follow the steps of this link.
After follow this, you can easely create favorite links to your "sidebar" if you use Gnome 3 as me, or make desktop shortcuts without needing sudo privileges, just using the gnome-desktop-item-edit tool or whatever you prefer.

How to make Eclipse behave well in the Windows 7 taskbar?

All other apps that can be pinned to the taskbar behave well.
But Eclipse doesn't show recently open projects when I right click it.
It also doesn't allow to pin some projects inside it.
Note that I have the JS version of Eclipse Helios. Which spawns a new and different taskbar icon after loading.
Specify the latest available Java VM in your eclipse.ini. I.e.:
-vm
jdk1.6.0_10\jre\bin\client\jvm.dll
Make sure they are on separate lines
Anything after the "vmargs" is taken to be vm arguments
(More info)
Or alternatively add the java bin folder to your Windows PATH before the "windows32" folder, because otherwise eclipse uses "javaw.exe" in the win32 folder instead of the JDK one.
Riccardo's solution from the Eclipse bug report worked for me, but I don't get recently opened projects, etc. from the task bar. Is anyone experiencing that these workarounds restore that behavior?
I have the same problem on Windows 7 x64 with Helios x64, but for me
the following workaround works with the option "Always combine, hide
labels" for taskbar buttons.
Check your "eclipse.ini" for the specified VM and make sure the path points to the bin directory of your JDK or JRE (and not to javaw.exe).
For me the argument is "D:/Development/Languages/Java/Development
Kit/bin/" without quotes.
Unpin Eclipse from the taskbar or delete the shortcut
Run "eclipse.exe" from the explorer and choose your workspace
Pin Eclipse to the taskbar after the splash screen was loaded and when the main window is shown
setting eclipse.exe to compatibility mode works
I just want to add this for the Win10 users.
Edit eclipse.ini to add these lines at the end before the line --launcher.appendVmargs:
-vm
C:/Program Files/Java/jdk1.8.0/jre/bin/server/jvm.dll
You need set the compatibility to Windows Vista as well in order for it to work.
I think it's important to mention that at least for me it was important to add the path to the vm in the eclipse.ini with forward slashes, even though I'm working with Windows (7, that is). Eclipse didn't start when I used backslashes.
The solutions offered here on StackOverflow so far, don't have an easy fix for running multiple Eclipses while each having their own Application ID, and making grouping of icons work as expected. The answer here does provide a reference to the underlying System.AppUserModel.ID property.
Here's a quick HOWTO:
Do the -vm setting as plenty of people here have mentioned
Run the eclipse app
Right click on the running taskbar icon, Pin this program to taskbar
Navigate to %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar
Copy the newly created shortcut to another location. It will be named eclipse, eclipse (2), or eclipse (3) and so on
Right click on the running taskbar icon, Unpin this program from taskbar
Use the Shortcut Properties dialog to copy all individual fields (target + parameters, workdir, icon, anything else) to the new shortcut
Rename the new shortcut
Drag the new shortcut to the Windows Taskbar
Done
Here's an extended HOWTO, helpful if you want icon grouping separated per individual Eclipse instance (if you have multiple instances running):
Find out what your startup plugin is, for example org.eclipse.epp.package.java_2.0.1.20130919-0803. Open the plugin.xml file of that folder.
Edit the following XML location in that file: /plugin/extension/product/property[#name="appName"], set attribute value to something else. Don't use spaces, keep length below (up until) 40.
Optionally also set the window title: /plugin/extension/product/property[#name], set attribute name to something else.
In your existing Eclipse shortcut, append -clean and run it once. You will notice the //product/property[#name] attribute being used in the Eclipse window title. Afterwards, you can remove -clean again.
Follow the quick HOWTO above
A quick explanation on What's going on here:
Inside the .lnk file, an attribute is stored, which can't be entered by using the windows Shortcut Property dialog. If you copy a .lnk file, the attribute will copy with it.
Windows groups by identical System.AppUserModel.ID property, AppID for short
Eclipse does not have an AppID at startup. First the JVM is started, then the eclipse core/platform is started, and then the startup plugin is loaded. In this last stage, an API call is done to set the AppID to the value inside a plugin.xml file. See above: extended HOWTO item 2
When you drag a manually created shortcut .lnk file to the taskbar, it makes sense that windows can't put this AppID into the new 'pinned' version of the .lnk file. It can only be detected at runtime.
When you start an Eclipse application, right click on the running taskbar icon, Pin this program to taskbar -> then Windows will detect the AppID and store it in the 'pinned' .lnk. But, partly because of the JVM process redirection, Windows does not detect the command-line parameters, environment, working folder (at startup at least), and the icon path + icon index. So you have to:
Do a file copy of the .lnk file and fill in the missing gaps yourself
Or, use a shortcut creation tool that understands System.AppUserModel.ID properties (there are plenty)
Or, use the Windows API directly
Sincerely hope this will reduce the amount of haywire Eclipse taskbars icons on the workstations around me,
Cheers, TW
Recently Timo Kinnunen has pinpointed the problem
Edit eclipse.ini find the line:
--launcher.appendVmargs:
and change it to
--launcher.appendVmargs:-vm <PATH_TO_JAVA>/jdk1.8.0/jre/bin/server/jvm.dll
This causes the JVM to be launched in the same process as eclipse.exe rather than as a child process and avoids the intricacies of Host Processes with AppUserModelIDs.
And it works !!!

Open multiple Eclipse workspaces on the Mac

How can I open multiple Eclipse workspaces at the same time on the Mac?
On other platforms, I can just launch extra Eclipse instances, but the Mac will not let me open the same application twice. Is there a better way than keeping two copies of Eclipse?
This seems to be the supported native method in OS X:
cd /Applications/eclipse/
open -n Eclipse.app
Be sure to specify the ".app" version (directory); in OS X Mountain Lion erroneously using the symbolic link such as open -n eclipse, might get one GateKeeper stopping access:
"eclipse" can't be opened because it is from an unidentified developer.
Your security preferences allow installation of only apps from the Mac App Store and identified developers.
Even removing the extended attribute com.apple.quarantine does not fix that. Instead, simply using the ".app" version will rely on your previous consent, or prompt you once:
"Eclipse" is an application downloaded from the Internet. Are you sure you want to open it?
By far the best solution is the OSX Eclipse Launcher presented in http://torkild.resheim.no/2012/08/opening-multiple-eclipse-instances-on.html It can be downloaded in the Marketplace http://marketplace.eclipse.org/content/osx-eclipse-launcher#.UGWfRRjCaHk
I use it everyday and like it very much! To demonstrate the simplicity of usage just take a look at the following image:
EDIT: Milhous's answer seems to be the officially supported way to do this as of 10.5. Earlier version of OS X and even 10.5 and up should still work using the following instructions though.
Open the command line (Terminal)
Navigate to your Eclipse installation folder, for instance:
cd /Applications/eclipse/
cd /Developer/Eclipse/Eclipse.app/Contents/MacOS/eclipse
cd /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
cd /Users/<usernamehere>/eclipse/jee-neon/Eclipse.app/Contents/MacOS
Launch Eclipse: ./eclipse &
This last command will launch eclipse and immediately background the process.
Rinse and repeat to open as many unique instances of Eclipse as you want.
Warning
You might have to change the Tomcat server ports in order to run your project in different/multiple Tomcat instances, see Tomcat Server Error - Port 8080 already in use
To make this you need to navigate to the Eclipse.app directory and use the following command:
open -n Eclipse.app
Actually a much better (GUI) solution is to copy the Eclipse.app to e.g. Eclipse2.app and you'll have two Eclipse icons in Dock as well as Eclipse2 in Spotlight. Repeat as necessary.
If the question is how to easily use Eclipse with multiple different workspaces, then you have to use a kludge because shortcuts in OS X do not provide a mechanism for passing command line arguments, for example the "--data" argument that Eclipse takes to specify the workspace. While there may be different reasons to create a duplicate copy of your Eclipse install, doing it for this purpose is, IMNSHO, lame (now you have to maintain multiple eclipse configurations, plugins, etc?).
In any case, here is a workaround. Create the following script in the (single) Eclipse directory (the directory that contains Eclipse.app), and give it a ".command" suffix (e.g. eclipse-workspace2.command) so that you can create an alias from it:
#!/bin/sh
# open, as suggested by Milhous
open -n $(dirname $0)/Eclipse.app --args -data /path/to/your/other/workspace
Now create an alias to that file on your desktop or wherever you want it.
You will probably have to repeat this process for each different workspace, but at least it will use the same Eclipse installation.
2018 Update since many answers are no longer valid
OS X Heigh Sierra (10.13) with Eclipse Oxygen
Go to wherever your Eclipse is installed. Right-click -> Show Package Contents -> Contents -> MacOS -> Double-click the executable called eclipse
A terminal window will open and a new instance of eclipse will start.
Note that if you close the terminal window, the new Eclipse instance will be closed also.
To make your life easier, you can drag the executable to your dock for easy access
Instead of copying Eclipse.app around, create an automator that runs the shell script above.
Run automator, create Application.
choose Utilities->Run shell script, and add in the above script (need full path to eclipse)
Then you can drag this to your Dock as a normal app.
Repeat for other workspaces.
You can even simply change the icon - https://discussions.apple.com/message/699288?messageID=699288&#699288
One another way is just to duplicate only the "Eclipse.app" file instead of making multiple copies of entire eclipse directory. Right-Click on the "Eclipse.app" file and click the duplicate option to create a duplicate.
If you're like me, you probably have terminal running most of the time as well.
You could just create an alias in /Users//.bash_profile like this
alias eclipse='open -n path_to_eclipse.app'
then all you have to do is just open the terminal and type eclipse.
Based on a previous answer that helped me, but different directory:
cd /Applications/Eclipse.app/Contents/MacOS
./eclipse &
Thanks
You can create an AppleScript file to open Eclipse with a given workspace. You can even save the AppleScript file as an Application, which is equivalent to creating an alias with arguments in Windows OS.
Open Script Editor and type the following:
do shell script "open '/path/to/your/Eclipse/installation' -n --args -data /path/to/your/workspace"
For instance:
do shell script "open '/Applications/Eclipse.app' -n --args -data /MyWorkspaces/Personal"
Press the Run button to check it's working.
This script can be saved as such, but I prefer to save it as an Application. That way I can customize the icon by copying the *.icns icon from the original Eclipse.app bundle to the script application bundle.
To open an App folder, use the "see contents" contextual menu option. It should look like this:
Where "main.scpt" is the AppleScript file and "applet.icns" is the icon from the original Eclipse bundle.
Launch terminal and run open -n /Applications/Eclipse.app for a new instance.
I found this solution a while back, can't remember where but it still seems to work well for me.
Create a copy of Eclipse.app for each workspace you want to work in (for this example ProjectB.app), then open ProjectB.app/Contents/MacOS/eclipse.ini and add these two lines at the beginning of the file:
-data
/Users/eric/Workspaces/projectb
... substituting where your workspace is located. When you launch ProjectB.app it will automatically start with that workspace instead of prompting for a location, and you should be able to run it at the same time as other Eclipse instances with no problem.
In Terminal simply paste below line and hit enter ..
/Applications/Eclipse.app/Contents/MacOS/eclipse ; exit;
If you want to open multiple workspaces and you are not a terminal guy, just locate the Unix executable file in your eclipse folder and click it.
The path to the said file is
Eclipse(folder) -> eclipse(right click) -> Show package
Contents -> Contents -> MacOs -> eclipse(unix executable file)
Clicking on this executable will open a separate instance of eclipse.
A more convenient way:
Create an executable script as mentioned above:
#!/bin/sh
cd /Applications/Adobe\ Flash\ Builder\ 4.6
open -n Adobe\ Flash\ Builder\ 4.6.app
In you current instance of Flashbuilder or Eclipse, add a new external tool configuration. This is the button next to the debug/run/profile buttons on your toolbar. In that dialog, click on "Program" and add a new one. Give it the name you want and in the "Location" field, put the path to the script from step 1:
/Users/username/bin/flashbuilder
You can stop at step 2, but I prefer adding a custom icon to the toolbar. I use a the Quick Launch plugin to do that:
http://sourceforge.net/projects/quicklaunch/files/
After adding the plugin, go to "Run"->"Organize Quick Lauches" and add the external tool config from step 2. Then you can configure the icon for it.
After you save that, you'll see the icon in your toolbar. Now you can just click it every time you want a new Flashbuilder/Eclipse instance.
You can run multiple instances of Eclipse by creating a pseudonym for Eclipse application in it's folder and using it for running new Eclipse instance
Lets try downloading this in your eclipse on Mac you will be able to open multiple eclipse at a time Link
Name : macOS Eclipse Launcher
Steps :
Go to eclipse Market place.
Search for "macOS Eclipse Launcher" and install.
It will restart .
Now under file menu check for open option > there you will find other projects to open also at same time .
Window -> New Window
This opens a new window and you can then open another project in it. You can use this as a workaround hopefully.
It actually allows you to work in same workspace.