I have this command line app that uses Xodus as embedded database. And the program has this bizarre problem.
When run using:
mvn exec:java
or using IntelliJ run command, the programs works fine. It can read and write to the Xodus database fine. However, when packaged as jar or native image, both does not work.
So here's what I did, since the packaged jar or native image fails to read/write properly, I copied the database file from the one that was generated from the mvn exec:java
and the IntelliJ run command, then did the "export database" command that is available in the command line app.
From there, I compared the CSV output of both programs:
- The exported CSV from the maven or IntelliJ run, the CSV data is clean.
- The exported CSV from the jar or native image run are both messy.
I can't really tell how is this happening. I wonder how is this even possible when the premise of Java is portability, not sure if the issue is that I use MacOS on M2 chip. Is there a difference in the runtime when running in maven vs running on java -jar
? (btw, other parts of the program that does not use the database works fine, that's why I am assuming that the issue is with the use of Jetbrains Xodus Database)
Any theories are welcome.