R
roger_pearse
I'm sure this is a silly question, but I'd like to iterate through the
system properties, and can't figure out from the Sun tutorial how to do
this. Modifying the simplest HelloWorldApp:
---start---
import java.util.*;
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
Properties myprops = System.getProperties();
// need to loop around these somehow and print out...
for (Iterator i = myprops.iterator(); myprops.hasNext(); ) {
}
}
}
---end---
This won't compile:
HelloWorldApp.java:13: cannot find symbol
symbol : method iterator()
location: class java.util.Properties
for (Iterator i = myprops.iterator();
myprops.hasNext(); ) {
^
HelloWorldApp.java:13: cannot find symbol
symbol : method hasNext()
location: class java.util.Properties
for (Iterator i = myprops.iterator();
myprops.hasNext(); ) {
^
2 errors
No doubt I am doing something really crass -- anyone care to help me?
Thanks,
Roger Pearse
system properties, and can't figure out from the Sun tutorial how to do
this. Modifying the simplest HelloWorldApp:
---start---
import java.util.*;
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
Properties myprops = System.getProperties();
// need to loop around these somehow and print out...
for (Iterator i = myprops.iterator(); myprops.hasNext(); ) {
}
}
}
---end---
This won't compile:
HelloWorldApp.java:13: cannot find symbol
symbol : method iterator()
location: class java.util.Properties
for (Iterator i = myprops.iterator();
myprops.hasNext(); ) {
^
HelloWorldApp.java:13: cannot find symbol
symbol : method hasNext()
location: class java.util.Properties
for (Iterator i = myprops.iterator();
myprops.hasNext(); ) {
^
2 errors
No doubt I am doing something really crass -- anyone care to help me?
Thanks,
Roger Pearse