View Single Post
Old 10-07-07, 09:48 AM   #1
jcrox
Mahna Mahna
 
jcrox's Avatar
 
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,134
Default Anyone know java properties?

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]);


}
}
}
__________________

Gaming

MSI MPower Z87 | 4770k | CNPS9900MAX-B | 8GB G.Skill 1866 | EVGA GTX760 |ThermalTake 850w | X-Fi Titanium | HAF | Asus PA248Q | Lycosa | Death Adder | Win8 Pro 64

Dev/Backup

MSI GD65 | 2500k | H50 | 8GB G.skill | GTX570 | Ubuntu 13.10

Laptop

17" Inspiron | i5 | 4GB DDR3 | 500GB HDD | Win7 Pro 64

jcrox is offline   Reply With Quote