File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Classpath file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Classpath file" Watch "Classpath file" New topic
Author

Classpath file

Vinicius Carvalho
Ranch Hand

Joined: Dec 07, 2004
Posts: 61
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

Joined: Apr 14, 2004
Posts: 10336

Look at the java.lang.ClassLoader method getResourceAsStream().


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classpath file
 
Similar Threads
solution to read a file from FacesContext
How to locate "system:user.dir" on websphere?
file searching with file name in a specific root directory
Look and Feel
Set my Java application as the default program to open a file extension