0

I am new to java development and need a suggestion.

I need to import some external jar file into eclipse to use the methods. However that external file has a property file from which it gets the configuration. Now I am able to include the external jar file into my project but cannot include the properties file. it is throwing error when I add property file in the external file library.

Could you please suggest how to achieve this?

singhabhisek
  • 57
  • 1
  • 8
  • Can you please add the code where you use the properties file (if you are using it directly in your code) and the stacktrace to a depth of about 4-5 method calls? – Sree Kumar Feb 02 '20 at 14:42

1 Answers1

0

Add the property file to the class path, and keep it externally. Many libraries use property files to configure themselves. For example, logback and log4j do.

java -cp propertyfile

Use the -cp parameter when launching the program. Refer to the documentation of the external library you are using for more information.

  • Thanks. Can I add that external property file in my java program, like I am doing for the external jar and export it as single jar with no dependency on additional file? I wanted to have a single JAR file that includes my program and external jar/config. – singhabhisek Feb 03 '20 at 04:32
  • Could you please let me know the steps how to do that? Any screenshot would be helpful. – singhabhisek Feb 03 '20 at 08:17
  • https://stackoverflow.com/a/10132818/4425643 you can always post a new question if you have trouble creating the jar file. personally I was using ant but no one uses that anymore – CausingUnderflowsEverywhere Feb 03 '20 at 14:24