|
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
As an Amazon Associate we earn from qualifying purchases.
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.