Skip to content
Advertisement

Exception while trying to run java program from maven

I have a small java program that connects to a mysql db and reads data from it. I am able to run it successfully using java -cp but when I try to run it using mvn exec:java I get this exception after the program has finished:

JavaScript

Why is this happening and how can I fix this? Here is my code in case it is needed:

JavaScript

Advertisement

Answer

Try this in the exec maven plugin

JavaScript
Advertisement