Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Classpath file

 
Vinicius Carvalho
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there! I have a propertie file that I load to find out which hibernate.cfg.xml should I read. This file is located under my project root folder, and after deployed under the EAR root folder. The class that reads it, is located in a package com.mycompany.persistence.util.
I'd like to read this file using a relative path, is it possible?

like properties.load("/mypropertie.properties");

I'm using a absolute path (c:\jboss\server\....) which is no desirable.

Any suggestions?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the java.lang.ClassLoader method getResourceAsStream().
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!