JAVA property files
6 Message(s) by 2 Author(s) originally posted in java misc
| From: KenStahl |
Date: Saturday, October 07, 2006
|
I've 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 \
character s are stripped out.
How can I prevent this from happening to that the
string
reads in correctly?--
If you can not be the flame, do not be the moth.
| From: Lew |
Date: Sunday, October 08, 2006
|
| From: KenStahl |
Date: Sunday, October 08, 2006
|
wrote in message:
wrote in message:
I've 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 not be the flame, do not be the moth.
| From: Lew |
Date: Sunday, October 08, 2006
|
wrote in message:
wrote in message:
I've 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?
wrote in message:
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
| From: KenStahl |
Date: Sunday, October 08, 2006
|
wrote in message:
wrote in message:
I've 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 not be the flame, do not be the moth.
| From: KenStahl |
Date: Sunday, October 08, 2006
|
wrote in message:
wrote in message:
wrote in message:
I've 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?
wrote in message:
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 was not clear on something and I should've been. The
property file isn't controlled by my application so I've
to
accept it in its present form. Obviously the people who
wrote in message the controlling application know what they did to get
around the problem but I do not have access to them.--
If you can not be the flame, do not be the moth.
Next Message: Dynamic array creation
Blogs related to JAVA property files
Pagination with DisplayTag
Download Displaytags from here, and include the displaytag-1.1.jar
file in your classpath.
... This
file is placed in the same directory as the Employee.
java class.
... <
property name="connection.driver_class">oracle.jdbc.driver.
...
Mysql webhost - JavaSercer Pages 5.2.3 Formatting HTML Output If you
In the JSP
file, double quotes are used to enclose the value of the
... The bean is designed so that when you use these
property names, all troublesome characters
... If you’re curious about the
Java code for the formatted properties,
...
RE: Configuring a MySQL Datasource in Apache Tomcat
After unpacking the
file you have downloaded, you'll find a
file called something like
... Copy this
file into the common/lib directory of your Tomcat installation.
... CDATA[
java:comp/env/jdbc/confluence]]>
property>
...
Many-to-Many using FDS & Hibernate
What I found encouraging is that it only created the Employee.
java and the
... the corresponding destinations in my data-management-config.xml
file.
... property="events" destination="crm.event.hibernate" lazy="false" /> ...
ResourceBundle pain.
Java Property-files (and ResourceBundles in extension) will only load files in ISO-8859-1 format. Of course, you can use Unicode escape codes in the files, but that is not very convenient. Java is, over all, really good at ...
Data Access with Spring and Struts: Part 2
<property name="url"> jdbc:oracle:thin:@localhost:1521:orcl ... The bean name "/search" is used to as a link between this file and struts-config.xml ... Employee.java. REQUIREMENTS. JAR Files: In order for you to run this ...