eclipse/java help

BiggusGeekus

That's Latin for "cool"
Given:


public class bar {

/**
* The program main.
*/
public static void main(String[] args) {

System.out.println(System.getProperty("\n" +"***"+ "foo"));

}

}


How do I set "foo" to pretty much anything other than null in eclipse? The build.properties file, the arguments tab in the run menu, and the Environment tab in the run menu all show me no love.

I feel stoopid.
 

log in or register to remove this ad

BiggusGeekus said:
System.out.println(System.getProperty("\n" +"***"+ "foo"));

Is that really what you mean?

I doubt "\n" is part of the property... do you mean:

System.out.println("\n" + "***" + System.getProperty("foo"));

?
 

thpr said:
Is that really what you mean?

I doubt "\n" is part of the property... do you mean:

System.out.println("\n" + "***" + System.getProperty("foo"));

?

Yeah, the property is foo. It's basically the "HelloWorld" program in eclipse using properties. For the life of me I can't figure out how to import a properties file that my application points to and I can't figure out how to do the equivalent of java bar -Dfoo=someData
 

BiggusGeekus said:
Yeah, the property is foo. It's basically the "HelloWorld" program in eclipse using properties. For the life of me I can't figure out how to import a properties file that my application points to and I can't figure out how to do the equivalent of java bar -Dfoo=someData

Here is bar (note only "foo" is part of the property - your original class had a typo)

public class bar {
public static void main(String[] args) {
System.out.println("\n" + "***" + System.getProperty("foo"));
}
}

generally use: java -Dfoo="hi" bar

In eclipse, the -Dfoo="hi" needs to go into the VM arguments.

Select the Class, under the big Green Arrow/Dot, select Run..., then under the second subtab (arguments) put -Dfoo="hi" into the VM arguments
 


Remove ads

Top