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

How to display the first 10 characters only of a message stored in database?

ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.1 ruby-on-rails-3.2

In my inbox view, where I am able to list each individual message, I want to display the first 10 characters of a message if the message is larger than 10 characters or display the entire message. ...

jcrop is not working properly with IE

jquery internet-explorer jcrop

I have used crop in my .net web application. All the browsers are pretty much fine with the code. However, IE shows weird behaviour. I have tried other posts but they are either not helpful or kind...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.