Eclipse ${project_name} expanded inconsistently

I've been using Eclipse ${project_name} variable as a configuration class hack to determine which project is running.

VM args

-Dproject_name=${project_name} in the relevant JRE builder.

Code
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?

Answers


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.


Need Your Help

Developing via Remote Desktop

development-environment remote-desktop remote-access rdp

Has anybody any successful remarks about having a team working via Remote Desktop?

Fake S3 Service for testing

java amazon-s3 integration-testing jets3t

I have built a swing application that will upload a user's data onto S3. I am using the jets3t library to upload and interact with the S3 service. In order for me to do my testing, is there any way...