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.
I've been search for this and got this way :
- Created a /path/to/mydir directory at some place in my deployement system.
- Moved log4j.properties and META-INF and hibernate.properties and hibernate.cfg.xml to mydir.
and use this command
this is just example:
java -cp Myjar.jar:/path/to/mydir MyMainClass
the command that I write is like this:
java -cp coreservice.jar:/mon/properties CoreServiceController.java
I've try like that way but i got this error
Error: Could not find or load main class
anyone can help me to fix it or give the better way will be pleasure ~
====================(EDIT)===================================================
Oh my god ~ I have delete(cut) folder META-INF from my jar and paste to my config folder (/mon/properties)
and try this command again java -cp coreservice.jar;mon/properties/ id.co.bn
i.coreservice.controller.CoreServiceController
..... annnndddddd this work ;))
tha-nks for Apostolos, Antoniossss, Yasa and no name :)