I've been using Eclipse ${project_name}
variable as a configuration class hack to determine which project is running.
-Dproject_name=${project_name}
in the relevant JRE builder.
String projectName = System.getProperty("project_name");
The problem is that projectName is inconsistent across different machines, and sometimes in the same machine.
Sometimes it is parsed into ${project_name}
, sometimes into the the configuration project, and sometimes into the project calling the configuration.
We use Eclipse 3.6 and 3.71, if that's relevant.
Any ideas?
I have seen that the value of ${project_name}
depends on the project that has currently the focus in the IDE. A project has a focus for example when one of its files is selected in the package explorer or one of its files is opened in an editor and the focus is on the editor.
Unfortunately it is not related to the project to which the started application belongs to, and I don't know an Eclipse variable that contains that project (although I'm also interested in a solution for this).
So as a workaround, make sure you are actually in the right project when you run the application from within Eclipse.