eclipse command line switch to start with project - eclipse

What is the command line option to start eclipse with a specific project?
I can get the correct workspace using -data.
Within that workspace, I want to have a specific project loaded, similar to the "Go Into" command.

I don't think there is such an option right now.
Oening a file from the command line has only taken 9 years: bug 4922:
If your Eclipse Helios 3.6 eclipse.ini file contains "--launcher.defaultAction", you can open any file with:
eclipse.exe myFile
But open directly a project is still missing.

See this SO question which contains an Eclipse plugin that only loads specific projects (which are defined in a config file) into the workspace.

Related

Is there a way to open launch eclipse from command line, like vscode?

I am wondering if there is a command similar to code ., but for eclipse.
I'm using a Windows 10 computer.
Yes, the command line lets you open files using the --launcher.openFile parameter, and I think it prompts you with the "open projects from file system" wizard when you give it a directory. I'm not sure it works as smoothly since Eclipse lets you use the same binary for more than one workspace.
https://wiki.eclipse.org/Eclipse/OpenFileFeature

How do I make eclipse.ini stop changing when I restart eclipse?

I recently installed eclipse Luna for Windows 64-bit. I have the ini file customized. Specifically, I have to set the VM path because the reference to Java on the path is for a different JVM that does not work for eclipse.
Every time I close and reopen eclipse, the vm entry in the ini file is removed, so I have to set it all over again and open eclipse. Is there a setting in Luna to change this?
Eclipse itself doesn't do this; there are plugins which sometimes rewrite the ini file to "fix problems" (usually giving Eclipse more memory) and I've seen cases where Eclipse was started with a script that replaced the ini file with a "known good" copy.
In either case, you will have to examine your installation. Use the "About" dialog to find out which plugins are installed and then find out what they are and what they do. One of them is the culprit.
One way to work around the problem is to create a copy of the file as eclipse.config and use a CMD script to start Eclipse. The CMD script should copy eclipse.config to eclipse.ini and then start Eclipse. That way, anyone can change the INI file but it won't matter.

Enterprise Configuration of Workspace mechanic

I am using Google's Workspace Mechanic to configure my eclipse environment. All seems to work fine, except that for any fresh installation, the workspace mechanic opens up with a default location of its own (~/.eclipse/mechanic) to look for preference files.
As given in their documentation i tried including their code
(/instance/com.google.eclipse.mechanic/mechanicSourceDirectories=/shared/eclipse/tasks\:${user_homedir}/.eclipse/mechanic)
in my plugin_customization.ini , but it does not work for me.
Does anyone have any other idea as to how to achieve this?
Quite late, but I just needed the same configuration.
First locate your plugin_customization.ini (eg. 'find -name plugin_customization.ini' in your eclipse folder).
I had two files with same name, located in org.eclipse.platform and org.eclipse.epp.package.jee.
For me, the jee one was relevant and you can configure it as JSON Array.
com.google.eclipse.mechanic/mechanicSourceDirectories=["http\://server/mechanics/tasks.json","/tmp"]
This example shows how to configure a folder (/tmp) and via http location.
Under Windows, I found that when using the recent Eclipse Juno and the latest Workspace Mechanic I had to do the following:
Edit the (Java EE):
...\Eclipse_Juno_SR1\plugins\org.eclipse.epp.package.jee_1.5.1.20120828-0743\plugin_customization.ini
and add the following line at the end:
com.google.eclipse.mechanic/mechanicSourceDirectories=c:\\...\\eclipse_extensions\\WorkspaceMechanics
in order for the plugin to recognize the above directory as the shared folder...
The plugin preferences now correctly references the folder !
The documentation is for Eclipse on Linux/Unix. If you are running Eclipse on Windows you will need a different path.
Another aproch is to put the preferencces in another file and point to that file from your eclipse.ini with a line such as
-Declipse.pluginCustomization=/var/wsm/current/my.properties
or eclipse startup with
eclipse -pluginCustomization /var/wsm/current/my.properties
The following worked for me (for Eclipse Luna in Windows).
Open the Luna/plugins folder
Search for a folder that begins with org.eclipse.epp.package.
(and I ended up with org.eclipse.epp.package.java_4.4.1.20140925-1820)
Go inside that folder and edit plugin_customization.ini
Append the following at the end (to point to \\sharedserver\share\DEV\Workspace-Prefs-Luna):
#Workspace Mechanic Settings
com.google.eclipse.mechanic/mechanicSourceDirectories=\\\\\sharedserver\\share\\DEV\\Workspace-Prefs-Luna
Save and Close the file
Restart Eclipse

How to change the Eclipse default workspace?

Where can I change the default workspace in Eclipse?
If you mean "change workspace" go to File -> Switch Workspace
I took this question to mean how can you change the Default workspace so that when Eclipse boots up the workspace you want is automatically loaded:
Go under preferences then type "workspace" in the search box provided to filter the list. Alternatively you can go to General>Startup and Shutdown>Workspaces.
There you can set a flag to make Eclipse prompt you to select a workspace at startup by checking the "Prompt for workspace at startup" checkbox.
You can set the number of previous workspaces to remember also. Finally there is a list of recent workspaces. If you just remove all but the one you want Eclipse will automatically startup with that workspace.
Go to eclipse\configuration\
Open the file "config.ini"
Modify the line
osgi.instance.area.default="F:/Workspace/Java"
where "F:/Workspace/Java" should be your default workspace!
If you are talking about changing the working directory for a java program that you launch from within eclipse, then there's a space for that in the run configuration.
If you go to Run menu and select "Run Configurations..." then select your run configuration, then on the "Arguments" tab for a Java Application there is a place for you to edit the "Working directory". This alters the current directory that will be used for launching the java program.
See related question Default eclipse working directory if this is what you are meaning.
Whatever Frank has suggested to change in config.ini is correct. In case, if that didn't help, you need to remove path from recent workspace as below.
Go to eclipse\configuration\org.eclipse.ui.ide.prefs\
Open the file "org.eclipse.ui.ide.prefs"
Remove the first path in RECENT_WORKSPACES.
MAX_RECENT_WORKSPACES=5
RECENT_WORKSPACES=/Users/wrokspace1\n/Users/wrokspace2\n/Users/wrokspace3\n/Users/wrokspace4
RECENT_WORKSPACES_PROTOCOL=3
SHOW_WORKSPACE_SELECTION_DIALOG=false
eclipse.preferences.version=1
File > Switch workspace > add the workspace you like > Eclipse will restart using the workspace you wanted.
If you mean to change the directory in which the program execution will occur, go to "Run configurations" in the Run tab.
Then select your project and go to the "Arguments" tab, you can change the directory there. By default it is the root directory of your project.
Open a command prompt.
Change to the eclipse home directory and type "eclipse -clean"
e.g.
C:/eclipse>eclipse -clean
This will ask for the workspace selection. It will also force to set it as the default workspace.
Then, go to eclipsehome-->configuration-->settings folder.
open org.eclipse.ui.de.prefs in a notepad.
set this property to true from false.
SHOW_WORKSPACE_SELECTION_DIALOG=true
You will be asked for a workspace selection everytime.
If you want to change recent workspace manually in a configurationfile
org.eclipse.ui.ide.prefs exists in
eclipse > configuration > .settings > org.eclipse.ui.ide.prefs
open this file in an editor find RECENT_WORKSPACES in line #2 and in this line you can see recent workspaces and can change or even remove them.
In Eclipse, go to File -> Switch Workspace, choose or create a new workspace.
This is the only answer you got first when you search for default workspace, but any solution is not solved my problem, So I follow this step for a default workspace:
First copy shortcut icon for your eclipse.
Right click and go to properties,
add your workspace path with -data attribute,
In Target:
D:\eclipse_path\eclipse.exe -clean -data D:\workspace_path\workspace
For using the same shortcuts and preference into this workspace,
Export general --> preference from your working eclipse, it will generate one .epf file.
So, just import .epf file into your new workspace, and you are done.
If you want to create a new workspace - simply enter a new path in the textfield at the "select workspace" dialog. Eclipse will create a new workspace at that location and switch to it.
On Ubuntu I went to
~/.eclipse/org.eclipse.platform_4.3.0_1473617060_linux_gtk_x86_64/configuration/config.ini
and added this line at the bottom
osgi.instance.area.default=#user.home/workspace
and changed workspace to the dir path from my home to where I put my workspace.
I combined #Frank answer with #Ronan Quillevere's comment
My kepler eclipse went into not responding at boot (shortly after installing GAE support) which I traced to a corrupt workspace. I fixed this by closing kepler, renaming the workspace directory (in use) so kepler starts normally without a workspace, then used file >> switch workspace to generate new workspace. Then started populating that with my old projects that I still needed.
You can check the option that shows up when you start eclipse. Please see the figure below

Is it possible to add external command line tools to Netbeans?

Is it possible to use external command line tools in Netbeans?
Thank you.
After searching and searching and searching, this feature is just missing in netbeans although it would absolutely straightforward to implement and has been ask by user for 2 more than years...
Regards,
Stéphane
There is a Terminal window in NetBeans 7:
Open the menu, Window -> Output -> Terminal
What about using an Ant target? Ant files are quite comfortable to run from Netbeans.
<exec executable="${executable-full-path}" ...
The best option I've found is to use jmarsault's plugin that he calls NetBeans Command Shortcuts. This give you an icon in the command line where you can add command and terminal scripts to run. The display shows in the output window.
Installation files are available here and he has kept it up to date with the newest versions of NetBeans.
NetBeans Command Shortcut plugin
Installation:
Download the .nbm file for your version of NetBeans
Open Tools / Plugins / Downloaded / Add Plugins...
Select the .nbm file and allow the installation of the plugin.
In since at least version 9.0, there are two decent options:
Just create a script file. (I think you need the C++ plugin for this. Otherwise you have to create it outside NetBeans or as a text file.) In my case I created a JLinkGDBServer.sh that just executes JLinkGDBServer as a prerequisite to start an embedded debug session. This automatically sends the executable's output to a NetBeans terminal.
Add a tool to Tools/Options/Miscellaneous/SendTo. SendTo is a pop-up menu item for certain project entities, for example files but not the project. In my case, I could add a SendTo running the executable and use it by right-clicking on for example the .elf file (although for the GDB server I don't need any file name as an argument).