Menu

How to get external files into class path?

Bill Ewing
2006-01-30
2013-05-20
  • Bill Ewing

    Bill Ewing - 2006-01-30

    We are able to build a fat jar that runs when we include a certain configuration file in the fat jar.

    But, we want it to be outside of the jar so we can edit values in it.

    We tried specifying the file in the class-path setting of the fat jar dialogs, but this did not work. 

    Any ideas, workarounds will be appreciated.

    TIA,
    Bill

     
    • Ferenc Hechler

      Ferenc Hechler - 2006-01-30

      Hi Bill,

      try setting Class-Path to '.' and put the file into the same dir as the jar.
      If this will not work, please report some details about how the file is accessed from within the program.

      Best regards,

            feri

       
    • Bill Ewing

      Bill Ewing - 2006-02-03

      I tried doing what you recommended, Feri, but it did not work.

      The files are
      hibernate.cfg.xml
      log4j.xml
      log4j.dtd

      All three need to be in the class path.  The only way we can get things to work is by including them in the jar.  We would prefer to have them outside of the jar where we would occassionally tweak a parameter setting.

      Your help is appreciated,
      Bill

       
      • Ferenc Hechler

        Ferenc Hechler - 2006-02-03

        I have used Log4J without any problems. I used
        PropertyConfigurator.configure("./log4j.properties")
        which reads the configuration file from the file system. I am sure hibernate also supports reading the config from the file system.

        feri

         

Log in to post a comment.