Click to See Complete Forum and Search --> : Debug/Run Configurations in Eclipse
geppo
July 16th, 2009, 12:12 PM
Does anybody know where I can find a good tutorial on how to use the Run/Debug Configurations in Eclipse?
I have a lot of questions: for example I have defined a variable in the Environment tab. How do I refer to it in the Arguments tab?
I have tried %VAR_NAME%, ${VAR_NAME}, etc. but no luck.
Any idea?
Thank you!
postmortem
July 16th, 2009, 09:01 PM
if it is argument then it is simply string and up to your program to interpret it.
geppo
July 17th, 2009, 03:07 AM
I think I didn't explain myself very well.
In the Debug/Run Configurations wizard there is a tab called "Environment" and a tab called "Arguments". I thought I would be able to define a variable in the "Environment" tab and then use it in the "Arguments" tab.
For example I have defined a variable in the "Environment" tab called:
FAMILY_HOME=c:/home/europe
and in the "Arguments" tab (VM arguments textbox) I would like to define something like:
-DmyFolder=%FAMILY_HOME%/uk/england/london/lewisham
THE PROBLEM IS, %FAMILY_HOME% is not replaced with the value c:/home/europe. I'm pretty sure is a syntax problem. I have tried to use ${FAMILY_HOME} or $FAMILY_HOME, but they don't work either. I've done a search on the internet, but I couldn't find a good tutorial with examples on the Debug/Run Configurations wizard.
Any idea?
Martin O
July 17th, 2009, 09:09 AM
In the 'Run Configurations' dialog, 'Arguments' tab, there should be a button 'Variables...'. Clicking that button brings up a list of Eclipse variables, one of which is 'env_var'. Look into that. I beleive the Eclipse variables are documented in Eclipse's help, and there's a brief description in the variable dialog. I haven't used an environment variable myself, but it looks like that's what you should use.
geppo
July 17th, 2009, 09:43 AM
Thank you Martin: your suggestion sounded sensible, but unfortunately it doesn't work.
I've tried:
-DmyFolder=${env_var:FAMILY_HOME}/uk/england/london/lewisham
but it still doesn't replace it with the value.
I wonder what the point of the "Environment" tab is if the variables there defined cannot be used!
I am also surprised on how poor the documentation is on the topic, since launchers files seem such a useful feature to me.
Martin O
July 17th, 2009, 01:19 PM
Yeah, I just tried & saw it doesn't work. It does work if you use a real environment variable, like 'PATH' or 'HOMEDRIVE' (Windows XP environment variables). But I couldn't get it to work with an environment variable defined in the Run Configuration -> Environment tab. I'd try asking on an Eclipse forum if you haven't already.
mcq1
August 19th, 2009, 01:15 PM
Just ran into this problem today and saw your post trying to find a solution. I am using Eclipse3.3.
In the Debug window, on the arguments tab -
1. click on the Variables button, small dialog opens
2. click on Edit Variables (the button is mislabeled), another dialog box opens
3. add variable name, value, description (do not use double quotes, i.e. defining Windows paths)
EXAMPLE: LOGPATH C:\Documents and Settings\My Documents\Test Env test env
4. click ok
5. verify the new variable LOGPATH is defined in the "Select Variable" dialog box
6. click ok
7. In the program arguments textbox, define the argument using double quotes
EXAMPLE: "${LOGPATH}\sgwb1.log"
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.