• Post Reply Bookmark Topic Watch Topic
  • New Topic

Properties file inside a Jar is not loaded  RSS feed

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a batch file that calls a main class inside a jar file. In this jar file, I have a property file that is loaded as below:



When I run, I get an error saying that it is not able to find the myTrustStore.truststore file? Any ideas as to why my runtime is not able to find this file? I checked the jar file and it certainly contains the myTrustStore.truststore in it.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As its name suggests, FileInputStream reads from a file. If you want to read from the classpath, you need to use out Class.getResourceAsStream.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:As its name suggests, FileInputStream reads from a file. If you want to read from the classpath, you need to use out Class.getResourceAsStream.


Thanks for pointing that out!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!