File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JNLP and Web Start and the fly likes properties file fails to load Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "properties file fails to load" Watch "properties file fails to load" New topic
Author

properties file fails to load

Scott R.
Greenhorn

Joined: May 25, 2006
Posts: 2
I am trying to run my swing app which connects to an oracle database. It gets the database values (sid, port, etc) from a .properties file. I instantiate a new properties object and then try to load the .properties file from the jar as follows.

Properties p = new Properties();
try {
p.load(getClass().getResourceAsStream("properties/database.properties"));
} catch (IOException ex3) {
System.out.println("IO Error");
}

p.load(InputStream) is recieving a null value and thus not able to collect the database values I need.

I have used jar -tf to make sure the properties file is in the jar and it reads back:

MyPackage/properties/database.properties

I have also tried using the classloader from previous posts but to no avail.

Any Ideas?


Insert self serving signature here.
Scott R.
Greenhorn

Joined: May 25, 2006
Posts: 2
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
You will have to sign your jars to allow access to network resources (JDBC connection)


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Sudeep Agrawal
Ranch Hand

Joined: May 31, 2006
Posts: 34
Originally posted by Scott R.:
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?


Yup you can connect to the Oracle database using JDBC, or via Datasource.
Sudeep Agrawal
Ranch Hand

Joined: May 31, 2006
Posts: 34
Originally posted by Scott R.:
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?


Yup you can connect to the Oracle database using JDBC, or via Datasource.
Balachandran Paranjothimani
Ranch Hand

Joined: Jun 18, 2005
Posts: 43
I had similar problem where I was loading application specific properties file by using Properties class. It failed. For now, I am passing it as the input arguments to the main method by using the JNLP file. I am just curious, how did you fix your problem?


Moderator : <a href="http://groups.yahoo.com/group/OOAD_UML/" target="_blank" rel="nofollow">http://groups.yahoo.com/group/OOAD_UML/</a><br />Home : <a href="http://www.zepho.com" target="_blank" rel="nofollow">http://www.zepho.com</a>
ved gunjan
Ranch Hand

Joined: May 17, 2003
Posts: 86
Hi Balachandran,
--------------------------------------------------------------------------
I had similar problem where I was loading application specific properties file by using Properties class. It failed. For now, I am passing it as the input arguments to the main method by using the JNLP file. I am just curious, how did you fix your problem?
--------------------------------------------------------------------------

I'm stuckup with reading the input arguments in the main method of the JNLP file....
can u tell me more about how to read these values...if u can paste your class then it would be great..

looking forward for reply.

Thanks
Ved
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: properties file fails to load