In Netbeans it works, not in Jar

Asked

Viewed 701 times

1

I know you have some similar topics, but none of them answer my question.

I created a program to insert information into the database and it works perfectly when I have netbeans compile.

I made the Jar, and when I use the program from the Jar, nothing is inserted in the database (MYSQL).

I don’t understand why this is happening.

  • 1

    Without an example of your code it is very difficult to answer your question

2 answers

0

I managed to solve, I’ll leave it here in case someone else has that problem too.

This happened because I was using the JAR outside the dist folder, and thus lost the connection to the MYSQL database by using an external jar for the MYSQL connection.

0


A command used to execute an executable class that was set as the default for the project (the one that was set as the default will be executed if there is more than one executable class inside the same jar) is the following:

java -jar filename.jar

As the questioner noted, if this project does not have all built-in dependencies, it will need to reference where the machine dependencies are.

A utility of the archives. executable jar is calling them via cron to perform system maintenance tasks such as generating daily reports, etc.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.