I'm looking for a file where Eclipse stores its launch configurations. I'm doing some Java development in Ubuntu.
One of the executables i'm developing requires an output from another executable as a argument to it. So say, the output of 'B' needs to be passed as a commandline argument to 'A'. In the Eclipse, I don't want to manually change the "Run Configuration" every time. Where does Eclipse store these configurations esp the arguments?
I found a "eclipseArguments.txt" in the extras folder of the project but this isn't the same as the arguments I'm passing into the Run Configurations. The ".project" file doesn't contain it either. I'm confused.
Thanks for the help.
You can find the configuration files in :
<workspace>/.metadata/.plugins/org.eclipse.debug.core/.launches
There should be a *.launch file for every configuration you have in this workspace stored there.
I'm not certain where Eclipse stores the 'local' run configurations (likely somewhere under the workspace .metadata directory), but under the 'common' tab of the Run Configurations dialog, there's an option to save it as a 'Shared file' within a project, in which case it will show up in your project directory.
I found it in Debug config. Once I run module, in the debug window I can right click an go to Properties or some similar option and then there is a full path with all arguments.
Related
I am working on bootstraping the process of workspace setup for new devlopers. Which file contains VM arguments.
All this is stored in a launch configuration. Those launch configurations can be stored in the projects themselves (for example if you want to commit them to a version control system) or they are located in the workspace metadata.
The default setting is the workspace metadata. Take a look at files in: <workspace>/.metadata/.plugins/org.eclipse.debug.core/.launches/
If you want to change the location to include the launch configs in your projects, go to the "Common" tab in the dialog that you posted above and select "Share file" instead of "Local file".
I have a problem with my war.xml file in that it isn't picking up my class files correctly for spring.
The line that is wrong is:
<dir sourceOnDisk="C:\myApp\src\main\java" targetInArchive="/WEB-INF/classes"/>
I need:
<dir sourceOnDisk="C:\myApp\bin" targetInArchive="/WEB-INF/classes"/>
Now, I can change the file manually (from src\main\java to bin), and it works correctly for a while, but every now and again something decides my war.xml file needs to be rebuilt, and things then break again.
I added my application by dragging my project from eclipse's Project Explorer tab to my liberty profile server instance within eclipse's Servers tab.
Where is the menu option within eclipse to change this?
To automatically map your bin folder to the WEB-INF/classes folder, select your project on the Project Explorer, right click it and select Java Build Path. In this property page on the Source tab, you can add, edit or remove the source folder, and also modify the default output folder. In this case you may only need to modify the output folder, to something similar to (project-name)/bin
Regarding the *war.xml file located at (server-dir)/apps, this will be refreshed each time you modify your project in eclipse, if when doing it, you have your server started and with automatic publish enabled. Usually you don't modify this file yourself, but you can read more about it here: http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.wlp.nd.doc/ae/rwlp_loose_applications.html?cp=SSAW57_8.5.5%2F1-14-1-10
Turns out the correct place to change things is in the Deployment Assembly option when you right click on your project...
I just used GWT's webAppCreator command-line utility, and noticed it produced a MyModule.launch file.
What is this .launch file, why do I need it, and what happens if I delete it?
Files ending in .launch are used to store project specific launch configurations. Normally, when you right click on a resource and select "Run As..." eclipse will store the settings you enter in a location that is specific to your machine, not within your project's working directory. If you want to share or persist your configurations, you have to generate a .launch file.
I suspect that webAppCreator is creating a .launch file to provide you with some sane defaults for launching your project. If you delete the .launch file, eclipse will still be able to launch the project, but you will be responsible for manually configuring the project's arguments and parameters.
If I am building an application in Eclipse using Java, and I want this application to read from a txt file, where should I put the txt file in the package in order to not have to specify its path (so that I can just say "file.txt"). I thought that it was supposed to go in the src folder, but it's not working.
Right click the project folder and click New -> file. The file will be in the Project folder and not in the source folder.
Put the file in the folder from where you run your Java application (your current/working folder). If you're using the default settings of Eclipse to run your application, you should put the file directly inside the Eclipse project folder. To create the file in the Eclipse project, you can simply drag-and-drop it there or right-click on the Eclipse project and create a new file.
The way this can be done is using .getResourceAsStream("file.txt")
SO thread
Downvoted for a correct answer? Wierd...
If you don't want to specify a path, and want to open a File from the file system using the java.io.File API, then put it in the working directory.
In Eclipse, the working directory defaults to the root level of your project, but you can modify it (and also review what it is set to) in an Eclipse Run Configuration. They are accessible under the "Run > Run Configurations..." menu option, and the working directory setting is under the "Arguments" tab for Java programs.
The important thing is for the directory containing your file to be on the classpath. When you're using Eclipse's run dialog for the settings of your project, there's a tab for classpath. You can use it learn what's already on the classpath, and to make additions if you want to.
As mentioned above by #tschaible, the Eclipse working directory defaults to the root of the project. Therefore, the program will look for the file from the root level.
However, if you intend to run the program from the command line, it acts differently because the working directory defaults to the folder that you are running the java file from (aka the src folder). Therefore, it is important to keep this discrepancy in mind when testing your java program from the command line.
I need to run Maven from the command line while Eclipse is open. Since this can confuse Eclipse, I configured the two to use different output folders (Maven writes to target, Eclipse m2e uses target-eclipse). This works very well.
But in one of my unit tests, I need to load classes which are part of a project but not on the classpath. Basically, I build my own URL classloader. Now, I have a problem: Which class folder to add?
If the project is open, target-eclipse/classes is the correct choice, otherwise I should use target/classes.
Assume that I know the Eclipse folder and the workspace folder. How can I tell from Java code running in a child process of Eclipse (not an Eclipse plugin) which projects are open and which aren't?
The existence of the folder is not a good criteria since the folder isn't deleted when I close a project.
[EDIT] Basically my question is: Eclipse must store that information somewhere in $workspace/.metadata or in $ECLIPSE_HOME/configuration. In which file do I need to look?
A file [Workspace_Home]/.metadata/.lock tells You the workspace is open.
The list and settings of projects in the workspace are in [Workspace_Home]/.metadata/.plugins/org.eclipse.core.resources/.projects.
It seems like open Java projects have a folder [Workspace_Home]/.metadata/.plugins/org.eclipse.core.resources/.projects/[Project_name]/.indexes, and closed don't have it. - I double checked it, and it seems I was wrong here.
But I just checked that closed Java projects have a file: [Workspace_Home]/.metadata/.plugins/org.eclipse.core.resources/.projects/[Project_name]/org.eclipse.jdt.core/state.dat, and open projects don't have it.
I would just use some configuration parameter (a system property for example), telling where the folder is. See http://maven.apache.org/plugins/maven-surefire-plugin/examples/system-properties.html for how to pass system properties when running tests with Maven. The first example in this page shows how to pass the build directory as a system property.