AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Java property files

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> comp.lang.java.misc
View previous topic :: View next topic  
Author Message
KenStahl
Guest





PostPosted: Sun Oct 08, 2006 7:10 am    Post subject: Java property files Reply with 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?


--
If you can't be the flame, don't be the moth.
Back to top
Lew
Guest





PostPosted: Mon Oct 09, 2006 12:18 am    Post subject: Re: Java property files Reply with quote



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





PostPosted: Mon Oct 09, 2006 2:15 am    Post subject: Re: Java property files Reply with quote



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





PostPosted: Mon Oct 09, 2006 2:46 am    Post subject: Re: Java property files Reply with quote

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





PostPosted: Mon Oct 09, 2006 3:04 am    Post subject: Re: Java property files Reply with quote

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





PostPosted: Mon Oct 09, 2006 3:10 am    Post subject: Re: Java property files Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> comp.lang.java.misc All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.