|
|
#1 | |
|
Mahna Mahna
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,123
|
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]); } } }
__________________
|
|
|
|
|
|
|
#2 | |
|
Mahna Mahna
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,123
|
update:
heres my set up: projects - classes ---java112 ----analyzer -----labs1 -----labs2 - config - data - docs - output - public_html - src --- java112 ------analyzer ------labs1 ------labs2 ------project2 ------tests ------util Ok, with the program in the above post I need to read the information from the labs2-3.properties file located in the config folder.... I can get it to compile just fine but no matter what I do I get a NullPointerException ![]() Here's the .bat file I'm using to try and run this... hopefully some java guru can help me "C:\Program Files\java\jdk1.6.0_02\bin\java.exe" -classpath classes;config java112.labs2.LabTwoThree "config/lab2-3.properties"
__________________
|
|
|
|
|
|
|
#3 |
|
Mahna Mahna
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,123
|
it works now
![]()
__________________
|
|
|
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Google (partially) loses suit to Oracle over use of Java API's | ViN86 | Mobile Devices And Smartphones | 3 | 05-17-12 10:25 AM |
| Judge Declines To Rule That Google Pillaged Java | News | Latest Tech And Game Headlines | 0 | 05-10-12 07:00 AM |
| BAH! I'm being driven insane by Java Virtual Machine | Kruno | General Software | 9 | 09-01-02 09:59 PM |