| View previous topic :: View next topic |
| Author |
Message |
KenStahl Guest
|
Posted: Sun Oct 08, 2006 7:10 am Post subject: Java property files |
|
|
I have a java application that reads a properties file. All
is well until I include a property like:
AppPath = C:\Program files\myprog\dat
When I use getProperty() to read the property the \
characters are stripped out.
How can I prevent this from happening to that the string
reads in correctly?
--
If you can't be the flame, don't be the moth. |
|
| Back to top |
|
 |
Lew Guest
|
Posted: Mon Oct 09, 2006 12:18 am Post subject: Re: Java property files |
|
|
KenStahl wrote:
| Quote: | I have a java application that reads a properties file. All is well
until I include a property like:
AppPath = C:\Program files\myprog\dat
When I use getProperty() to read the property the \ characters are
stripped out.
How can I prevent this from happening to that the string reads in
correctly?
|
Read
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
It explains how the backslash character '\' is interpreted.
- Lew |
|
| Back to top |
|
 |
KenStahl Guest
|
Posted: Mon Oct 09, 2006 2:15 am Post subject: Re: Java property files |
|
|
Lew wrote:
| Quote: | KenStahl wrote:
I have a java application that reads a properties file. All is well
until I include a property like:
AppPath = C:\Program files\myprog\dat
When I use getProperty() to read the property the \ characters are
stripped out.
How can I prevent this from happening to that the string reads in
correctly?
Read
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
It explains how the backslash character '\' is interpreted.
- Lew
|
That is all well and fine. I knew WHAT was happening. I just
need to know how to prevent it from happening?
Is my only resort to use StringTokerizer?
--
If you can't be the flame, don't be the moth. |
|
| Back to top |
|
 |
Lew Guest
|
Posted: Mon Oct 09, 2006 2:46 am Post subject: Re: Java property files |
|
|
KenStahl wrote:
| Quote: | KenStahl wrote:
I have a java application that reads a properties file. All is well
until I include a property like:
AppPath = C:\Program files\myprog\dat
When I use getProperty() to read the property the \ characters are
stripped out.
How can I prevent this from happening to that the string reads in
correctly?
Lew wrote:
Read
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
It explains how the backslash character '\' is interpreted.
- Lew
That is all well and fine. I knew WHAT was happening. I just need to
know how to prevent it from happening?
Is my only resort to use StringTokerizer?
|
As explained in the link, you can double the backslashes.
Or use forward slashes.
Read the link.
- Lew |
|
| Back to top |
|
 |
KenStahl Guest
|
Posted: Mon Oct 09, 2006 3:04 am Post subject: Re: Java property files |
|
|
Lew wrote:
| Quote: | KenStahl wrote:
I have a java application that reads a properties file. All is well
until I include a property like:
AppPath = C:\Program files\myprog\dat
When I use getProperty() to read the property the \ characters are
stripped out.
How can I prevent this from happening to that the string reads in
correctly?
Read
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
It explains how the backslash character '\' is interpreted.
- Lew
|
That is all well and fine. I knew WHAT was happening. I just
need to know how to prevent it from happening?
Is my only resort to use StringTokerizer?
--
If you can't be the flame, don't be the moth. |
|
| Back to top |
|
 |
KenStahl Guest
|
Posted: Mon Oct 09, 2006 3:10 am Post subject: Re: Java property files |
|
|
Lew wrote:
| Quote: | KenStahl wrote:
KenStahl wrote:
I have a java application that reads a properties file. All is well
until I include a property like:
AppPath = C:\Program files\myprog\dat
When I use getProperty() to read the property the \ characters are
stripped out.
How can I prevent this from happening to that the string reads in
correctly?
Lew wrote:
Read
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream)
It explains how the backslash character '\' is interpreted.
- Lew
That is all well and fine. I knew WHAT was happening. I just need to
know how to prevent it from happening?
Is my only resort to use StringTokerizer?
As explained in the link, you can double the backslashes.
Or use forward slashes.
Read the link.
- Lew
|
Ok, I wasn't clear on something and I should have been. The
property file is not controlled by my application so I have
to accept it in its present form. Obviously the people who
wrote the controlling application know what they did to get
around the problem but I don't have access to them.
--
If you can't be the flame, don't be the moth. |
|
| Back to top |
|
 |
|