My program works fine when I run it from Netbeans but as soon as I clean and build and move the dist directory out of the project to a remote location and run it using java -jar example.jar then I get the exception:
com.objectdb.o.UserException: Package com.example.model is not found by the enhancer
It occurs on this line:
com.objectdb.Enhancer.enhance("com.example.model" + ".*");
during contextInitialization.
In my setup I'm using JDK 8, Object DB and Embedded Tomcat 8.0.3 so after clean and build my dist directory contains:
1. lib directory with all the jars
2. example.jar
3. README.txt
However, in my source code's lib directory I have:
\lib\objectdb-2.5.4_05\database\example.odb
Which is obviously not present when cleaning and building with Netbeans and moving the dist directory to a remote location.
What are the possible solutions around this problem as I'm not sure how the enhance() method looks up the model path since it will be inside the example.jar after building?