Java JPA Class for MATLAB

Solution 1:

Well, I found "an answer." Somewhere before I saw a post about the difference in MATLAB's "dynamic" and "static" cp's. The "static" cp is a text file that is loaded at startup. The "dynamic" cp is loaded at runtime and you typically manipulate it with m-script calls. That's what I was trying to do.

So I added my jars to the dynamic path and it didn't work.

I added them to the end of the static path and got DIFFERENT errors, which seemed to pertain to the XML parsing. Progress!

Then I added my jars to the BEGINNING of the static path and it works.

To quote Bart Simpson: Craptackular.

Thanks for all your ideas. Ask me a C# question so I can reciprocate...

-reilly.

Solution 2:

While working with Java in MATLAB, I often encountered issues with the dynamic classpath. As a workaround, using classpath.txt has solved any issue so far.

Dealing with different environments, for example testing and production, results in multiple classpath.txt files in your MATLAB start directory. Using different MATLAB releases adds another multiplier to the number of classpath.txt files around.

ClassPathHacker.java is an option to add dynamically classes and jar files to your static classpath. Using this approach there is no need to touch classpath.txt anymore. Your Java classpath configuration can stay in the intended place startup.m.