Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using property file

 
Rafael Afonso
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

My Application use a property file, loaded to a Property class (see example). I need download this using JWS. My first attempt was use <resources>/<jar> tag:

But it did not work. When JWS launched my application, I got this message:

Bad MIME type returned from server when accessing resource: http://localhost:8080/teste/configdir/teste.properties - null

Probably JWS try downloaded this file like a binary one.
Someone suggest me to include property file in a jar file and load this in application using ClassLoader.getResourceAsStream(). But I preferred load this like a (text) File.
So my question is how download configuration or other helper files using JWS. Does JWS download only JAR files?

Thanks,
 
Jared Cope
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is not a direct answer to your question, but merely another way to accomplish the same task.

I actually make use of command line arguments to specify my properties files that the application requires:



Then in the application you can go:



Doing it this way gives you more flexibility to change config settings without having to rebuild your .jars too.

Cheers, Jared.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic