× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi
thanx, 

--- PierceJ@xxxxxxxxxxxxxxxx wrote:

> I believe the problem is that FileInputStream looks
> at the file system and
> not the classpath.  You are actually loading your
> property file from the
> current directory, that's why it is found when it's
> in your home directory.
> 
> If you want to load properties from your classpath,
> you can use something
> like:
> 
>
prop.load(ClassLoader.getSystemResourceAsStream("JDBCConnection.properties"));
> 
> If you want to load a properties file that exists in
> the current package,
> you could use something like:
> 
>
prop.load(MyClassTester.class.getResourceAsStream("test.properties"));
> 
> There are several different ways to load from the
> classpath.  You just need
> to choose the one right for you.
> 
> Here is a reference that may help you:
>
http://www.javaworld.com/javaworld/javaqa/2003-08/01-qa-0808-property.html
> 
> 
> 
> 
> Hi
> I have a java program running in batch, i submit
> this
> java program from CL, in CL i set class path as
> follows
> /approve/bin/approve.jar:/approve/
> suppose this is my file structure in IFS
> /-
>   --approve-
>             |
>             --
>             | |
>             | -- bin
>             |       |
>             |        -- approve.jar
>             |
>             |
>             JDBCConnection.properties
> In a java class i try to access
> JDBCConnection.properties file as below
> Properties prop = new Properties();
> prop.load(new
> FileInputStream("JDBCConnection.properties"));
> 
> I get file not found exception,
> But i copy this file to /home/<myuserid>/ folder on
> IFS then it finds it,
> 
> What do i have to do so that java program will find
> it
> in /approve/ folder
> 
> Ashish
> 
> 
> -- 
> This is the Java Programming on and around the
> iSeries / AS400 (JAVA400-L) mailing list
> To post a message email: JAVA400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit:
> http://lists.midrange.com/mailman/listinfo/java400-l
> or email: JAVA400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the
> archives
> at http://archive.midrange.com/java400-l.
> 
> 


A$HI$H


                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.