0

I have a Debug Configuration in Eclipse in which I set some variables, some dependent on each other:

$var1=some/path
$var2=${var1}/lib

I want to see the value of these variables as the program runs, but I can't figure out how to do this. I expect to see something like:

$var1=some/path
$var2=some/path/lib
RockManX77777
  • 151
  • 1
  • 7

1 Answers1

0

Printing the environment variables is easy:

Live On Wandbox

package so;

import java.text.MessageFormat;
import java.util.Map;

public class Program {

    public static void main(String[] args) {
        Map<String, String> getenv = System.getenv();
        for (String entry : getenv.keySet())
        {
            System.out.println(MessageFormat.format("{0}={1}", entry, getenv.get(entry)));
        }
    }

}

If you actually want to expand variables in string "templates", that's a different question (which I'm sure has been answered before):

Community
  • 1
  • 1
sehe
  • 374,641
  • 47
  • 450
  • 633
  • So the only way to see the Debug Configuration variables' values is to use` getenv()` within the project being debugged? I use these variables as arguments to jvm. There's no `-verbose` to see what ends up being passed to the jvm? – RockManX77777 Oct 09 '15 at 20:26
  • The environment is not passed as options to jvm if that's what you mean. So, you just want to see the _expanded_ values of the macro config values in your debug configuration. Aha. Well, I don't think there's a "verbose" thing indeed. – sehe Oct 09 '15 at 20:28