Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

Reply
 
Thread Tools
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
Old 10-07-07, 01:31 PM   #2
jcrox
Mahna Mahna
 
jcrox's Avatar
 
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,134
Default Re: Anyone know java properties?

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"
__________________

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
Old 10-07-07, 02:53 PM   #3
jcrox
Mahna Mahna
 
jcrox's Avatar
 
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,134
Default Re: Anyone know java properties?

it works now
__________________

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
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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 Archived News Items 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

All times are GMT -5. The time now is 10:41 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.