Announcement Announcement Module
No announcement yet. outside of my deployed jar file Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • outside of my deployed jar file


    I am sure my problem is a common problem, but I cannot seem to find an solution in the forums.

    I have a Java application that uses Spring/Hibernate. I package this application up into a batch.jar file that contains all of my class files and applicationContext.xml files. I am also using PropertyPlaceHolderConfigurer in my applicationContext.xml file to load my database specific information. This information is contained in a file called ''

    I am trying to run my batch on the UNIX command line like the following.
    java -classpath $HOME/lib/batch.jar:$HOME/properties/ com.putnam.fams.batch.BatchProcessMain

    Spring keeps failing because it cannot find the file. When I put the file inside of the batch.jar file it works fine. I need to have it outside of the jar so I am able to change it.

    Any help would be appreciated or please send me to a similar post.


  • #2
    Have you tried setting just the directory where your properties file lives in your CLASSPATH instead of the full file name? For example:

    java -classpath $HOME/lib/batch.jar:$HOME/properties com.putnam.fams.batch.BatchProcessMain
    Then, something like the following for your PropertyPlaceholderConfigurer:

    <bean  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value=""/>


    • #3
      This works

      Hello; Thanks for that response. I got dragged into another direction so I wasn't able to respond. This works; I appreciate your help. Thank You Peter


      • #4
        Hi, I am using -jar option instead of classpath option.
        /opt/java/bin/java -jar /opt/testhrjobs/script/gmsglp/java1/gmsglp_batch.jar glprunner.xml glpFeed

        the last two arguments are paramaters to main function of the first class that would be invoked.

        Can you please help to frame command to refer a file(data.txt) which sits in
        /opt/testhrjobs/data/gmsglp/incoming/data.txt folder? PLease note code is in script folder and data.txt is in data folder.

        Any help would be appreciated.

        Mansih G


        • #5
          can u tell me the way how it worked... iam dying with it..

          where am using this
          nohup java -cp "lib/" -jar rxdatatransfer.jar rxtConfig.xml >& /dev/null &


          • #6
            can u tell me the way how it worked... iam dying with it..

            where am using the following

            nohup java -cp "lib/" -jar rxdatatransfer.jar rxtConfig.xml >& /dev/null &

            in this case where to include the .properties file...