This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

ClassLoader  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to make jdbc connection in java object,
wants to read some properties file which will be
containing detail about db server like sid,port and ip.
I used ClassLoader.getResourceAsStream method, if
i copy that property file in jdk/lib folder, then it works. If i keep it some where else it won't work?
please tell me how this ClassLoader works?
regards
ravikant
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't really relevant to this forum - "JDBC" or "I/O and Streams" would have been better.
The ClassLoader method you mention will find any file on the classpath, but I think you are barking up the wrong tree! This class is designed for loading the byte code for java class files.
you should use the ResourceBundle class in the java.util package for loading a properties file.
James
 
Sheriff
Posts: 12336
201
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"rvm76"
Please review the JavaRanch Naming Policy then edit your profile so that your publicly displayed name complies with the rules. Thanks for your cooperation.
-----
Moving this to I/O
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!