Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Mastering Corda: Blockchain for Java Developers
this week in the
Cloud/Virtualization
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Bear Bibeault
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Tim Cooke
Junilu Lacar
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Jj Roberts
Carey Brown
Bartenders:
salvin francis
Frits Walraven
Piet Souris
Forum:
Java in General
loading properties file
Manisha reddy
Greenhorn
Posts: 16
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
can i know the different ways of loading the properties file?
Thanks in advance
Jesper de Jong
Java Cowboy
Posts: 16084
88
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Different ways? Just do something like this:
Properties props = new Properties(); InputStream in = new FileInputStream("hello.properties"); props.load(in); in.close();
Jesper's Blog
-
Pluralsight Author Page
Sarath PS
Greenhorn
Posts: 11
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
put the props file in class path and try ,
Properties props = new Properties(); /* If /home/temp/classes dir is in class path prop file should be 'Hello.properties'. If it is inside '/home/temp/classes/com/test' you should load 'using com.test.Hello' */ props.load(getClass()getClassLoader().getResourceAsStream("Hello");
Jan Groth
Ranch Hand
Posts: 456
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
check this out
Manisha reddy
Greenhorn
Posts: 16
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks a lot
Jesper Young, Sarath PS ,Jan Groth
for your responses
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
(NX:URLyBird)A question about properties files:
where to put xml file so it gets built in ear
unbale to view xml file in browser
accessing resources from a jar file.
Will the Resource Bundle object loads property file into memory?
More...