0

I am using one property file in my simple eclipse java maven project. but when i execute jar file using Eclipse -> Export and run that executable jar file in command prompt i get the following error.

C:\Users\Administrator\Desktop>java -jar property.jar
java.io.FileNotFoundException: clientConfig.properties (The system cannot find t
he file specified)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at com.veni.property.App.main(App.java:19)

What is problem in the build procedure or path problem? Kindly find full eclipse java maven project link. https://drive.google.com/drive/folders/0B4wkBrJ4uyHMUzFoNERhV1Raams?usp=sharing

user3406181
  • 91
  • 1
  • 10
  • can you please update your code and check the file path. and also check its dynamic path – Spartan Jan 24 '17 at 06:45
  • I checked path with all possible ways but not working. I have given source code also. – user3406181 Jan 24 '17 at 07:28
  • Any source code you want us to look at must be in the question. From the exception it looks like you are trying the read the properties as a File - objects in a jar are not files and you cannot use file APIs to read them. Look at Class.getResourceAsStream. – greg-449 Jan 24 '17 at 07:46
  • Unable to see yur code.have a look at this : http://stackoverflow.com/questions/3844307/how-to-read-file-from-relative-path-in-java-project-java-io-file-cannot-find-th. – Spartan Jan 24 '17 at 08:28
  • @thanga Code is given and readable. I am not getting what is your problem with the code? and problem arises when jar file is run but it runs in eclipse. So may be problem with jar file build and property file path read. for that reason only i have uploaded the whole source code(eclipse java maven project) – user3406181 Jan 24 '17 at 09:08
  • @greg-449 code link is already there in the question. – user3406181 Jan 24 '17 at 09:09
  • @user3406181 No it isn't, a link is not good enough. No one is going to mess around downloading stuff to solve **your** problem. The Stack Overflow rules are very clear a [mcve] must be in the question. – greg-449 Jan 24 '17 at 09:38
  • @greg-449 How to get property file if its in another package from which i call class.getResourceAsStream? means calling class and property file are in different packages. – user3406181 Jan 25 '17 at 14:13

0 Answers0