Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to let hibernate know where to look for configuration file

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Thanked 0 Times in 0 Posts

    Smile How to let hibernate know where to look for configuration file

    I just export my java project to executable jar. I have somehow made my project work to access value from DB (hibernate.cfg.xml), config.properties, and log4j.properties & editable for future...

    I want to put hibernate.cf.xml, config.properties and log4j.properties in the outside of jar and place them somewhere in other directory...

    when I run my jar
    java -cp coreservice.jar;/mon/properties id.co.bni.coreservice.controller.CoreServiceController

    I got this error
    Could not find or load main class

    Any help will be pleasure ~

  2. #2
    Join Date
    Jul 2013
    Thanked 18 Times in 17 Posts

    Default Re: How to let hibernate know where to look for configuration file

    You can just give the full absolute path name for the hibernate config file in the java code.
    And while running the program you need to set the classpath settings appropriately so that you will not get "CLASS NOT FOUND" exceptions.


Similar Threads

  1. eclipse configuration problem
    By sighb0rg in forum Other Programming Languages
    Replies: 2
    Last Post: August 11th, 2013, 06:57 PM
  2. hibernate creating table without mapping file
    By Indrajeet in forum Web Frameworks
    Replies: 1
    Last Post: March 7th, 2013, 04:26 PM
  3. Replies: 2
    Last Post: January 12th, 2013, 12:16 PM
  4. Jar file does not work with database (Hibernate)
    By shomid in forum JDBC & Databases
    Replies: 2
    Last Post: December 27th, 2011, 11:03 AM
  5. CAS Configuration Problem
    By pacificz in forum Java Theory & Questions
    Replies: 1
    Last Post: July 24th, 2010, 01:44 PM

Tags for this Thread