Eclipse run configuration file exists in workspace - eclipse

I copied a couple of launch configurations (created by the same eclipse version) from another workspace into my current workspace, but I can't get them to show up on the UI.
And I am sure it is at the right place because it's where the config created in this workspace is located as well (That is, it is at ./.metadata/.plugins/org.eclipse.debug.core/.launches )
How do I get the copied configuration files to show up on the UI?

Don't copy Eclipse configuration files like that. Use the "Export" function in the old workspace and "Import" in the new one.

Use 'File > Export > Run/Debug > Launch Configurations' to export one or more launch configurations.
Use 'File > Import > Run/Debug > Launch Configurations' to import one or more launch configurations.

.metadata isn't meant for human manipulation. You can specify that a launch configuration should live in a workspace as a regular workspace file from the Common tab in most launch configurations, then just copy them across as part of the containing project.

Related

eclipse run/debug launch configs in ws/.../.launch do not show up in config dialog

regardless of importing them via file/import or just copy them from an old workspace to a new one (.metadata/.plugins/org.eclipse.debug.core/.launches) they didn't appear in the eclipse run/debug configurations dialog.
(however if i try to import them after i copied them already to that folder, i'm asked to override them - so that directory seems to be the correct one...)
my question is: how do i (re)import elder run/debug configurations to a new eclipse workspace?
update
this doesn't work out form me with versions 1903, 1909 and 1912
Do one of the following:
Export and import the launch configurations:
In the old workspace do File > Export...: Run/Debug > Launch Configurations
In the new workspace do File > Import...: Run/Debug > Launch Configurations
Share launch configurations:
In the old workspace in Run > Run Configurations... in the Common tab of all launch configurations to share select for Save as the option Shared file
Copy the <name>.launch file into a project of the new workspace
Please be aware that the files in .metadata are not intended to be edited or deleted.
thx #howlger for the approach - it was my fault and a silly mistake.
(i put this in here for the next luser like me XD)
the problem was, that the ones (the configs) I've missed did't show up, because the projects for this configs were not open in my new workspace. thats all.
when opening them, the configs will be listed in the overview.

Running ANT targets using .launch file

In one of my legacy project ant target is invoved from *.launch file. This file contains <launchConfiguration> tag and one of the attribute name "type" is ant class org.eclipse.ant.ANTLaunchConfigurationType, different parameter are set using this tag. When this launch file is executed in eclipse, one of the ANT target is executed specified in launchConfiguration tag.
I am not able to find any information around this functionality of ANT. Only relevant thread found is, which is unanswered
Running eclipse ant targets from an external command
I am not able to understand how launch files are created and how to set parameter to launchConfiguration tag.
The .launch files are created by Eclipse for every Run Configuration you want to be saved:
Open Eclipse.
Select a build.xml file.
Through the context menu, execute Run as/Ant build.... A dialog appears.
If you want to pass parameters to the Ant script, you have to fulfil the Arguments area (in the Main tab) like this:
-Darg1=value1
-Darg2=value2
...
Then, go to the Common Tab and focus on the Share file field: With the Browse button, select your project. This will create the .launch file into your project, and let it available for further executions. (You should rename it).
Execute Run.
You can edit the .launch configuration in menu Run>External tools>External tools configuration.
Note: Within the Run Configuration, you'd better spend some minutes reading all the parameters available in all the tabs. For example, in the Build tab, you can set if you want a project to be build before your script is executed (If not, unchecking the checkbox may save you a lot of time). Or in the Refresh tab, you can select which project directories you want to be refreshed after the script is executed, etc.
Launch configurations for Ant Builds are created and managed using the 'Run > External Tools > External Tools Configurations...' dialog.
You can import existing .launch files using 'File > Import... > Run/Debug > Launch Configurations'

How can I clone an Eclipse installation between computers?

How can I clone all of my Eclipse settings (preferences, plugins, etc) from one computer to another?
IIRC, Eclipse installs into a folder as opposed to all over the place like most Windows apps. Have you tried just copying the entire folder?
They are stored in the .metadata directory in your designated workspace directory. So you can copy that over, although some settings may not work right away as they contain absolute paths.
If you are referring to the plugins themselves, just copy the eclipse_dir/plugins folder
Eclipse has an import/export facility for general workspace Preferences:
File > Export > Preferences
Choose "Export All" and then provide a destination path and filename for your preference file (Eclipse will automatically add a .epf extension).
In a new (or existing) installation of Eclipse import the .epf file
File > Import > Preferences
Project specific settings, if you enabled (and configured these), are stored in the subfolders .classpath, .project and .settings inside the project folder. Assuming you preserve your project folders for use by the new Eclipse installation, your project-specific settings will remain safe.
Eclipse projects are also imported/exported via Eclipse file menu:
File > Import > File System
see this post regarding the way Eclipse uses the workspace .metadata directory

how to export or copy java applet parameters on eclipse

I set a bunch of applet parameters on run/debug configurations on eclipse.
I would like to share these parameters with my co-workers, but I cannot find an easy way to copy these parameters. I looked through the plugin and project files to figure out where these parameters are stored, but I couldn't find them. Does anyone happen to know where these configurations are stored?
thanks in advance...
Launch configurations in Eclipse can be saved in the workspace in one of the projects and committed under source control. When the project is imported in Eclipse, the launch configuration will be found and automatically added in Eclipse.
To store the launch configuration in the workspace:
Run > Run Configurations... > Select the launch configuration > Common tab > Shared file
In the text field, you specify the location, where the configuration to be stored.

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