jcrox
10-07-07, 11:48 AM
I need to output to the console the contents of a properties file and I'm lost... please help!!!
Heres my code so far:
package java112.labs2;
import java.util.*;
import java.io.*;
public class LabTwoThree {
private Properties props;
private String propsFile;
public void run(String propsFile) {
this.propsFile = propsFile;
loadProps();
What do I put in here to get the info in the properties file to output to the console?
}
public void loadProps() {
props = new Properties();
try {
props.load(this.getClass().getResourceAsStream(pro psFile));
}
catch(IOException ioe) {
System.out.println("Can't load the properties file");
ioe.printStackTrace();
}
catch(Exception e) {
System.out.println("Problem: " + e);
e.printStackTrace();
}
public static void main(String[] args) {
LabTwoThree go = new LabTwoThree();
go.run(args[0]);
}
}
}
Heres my code so far:
package java112.labs2;
import java.util.*;
import java.io.*;
public class LabTwoThree {
private Properties props;
private String propsFile;
public void run(String propsFile) {
this.propsFile = propsFile;
loadProps();
What do I put in here to get the info in the properties file to output to the console?
}
public void loadProps() {
props = new Properties();
try {
props.load(this.getClass().getResourceAsStream(pro psFile));
}
catch(IOException ioe) {
System.out.println("Can't load the properties file");
ioe.printStackTrace();
}
catch(Exception e) {
System.out.println("Problem: " + e);
e.printStackTrace();
}
public static void main(String[] args) {
LabTwoThree go = new LabTwoThree();
go.run(args[0]);
}
}
}