Database location in Eclipse IDE

Basically, where should you save your Java Databases in the project files? Should you save them in the project directory or some arbitrary location within your computer?

I have decided to write an article to demonstrate a step-by-step guide on where you should save your databases for any java project on any IDE.

Why Does Does Database Location Matter in any Java Project?

Well, the database location is very much important especially when it comes to distributing your Java Project. We must all agree that it’s hard to distribute your project with a database saved outside the Java project files.

Now the option left for us is to save the database inside the Java Project files. But Where Exactly? This article is going to illustrate the exact location you should save your database inside ava Project files, probably on any IDE.

Exact Location You Should Save Your Databases in Any Java Project

What does any project mean? Any project, is any kind of java project, for example, JavaFX project, Console Application and so on.

To understand where you should save your databases in any Java Application project, let’s first understand the file structure for any java project used by most IDEs. For our example, we are going to focus on three IDEs, i.e. Eclipse IDE, NetBeans IDE, and IntelliJ IDEA.

Eclipse IDE File Structure


Eclipse IDE File Structure

NetBeans  File Structure


Intellij IDEA File Structure

IntelliJ IDEA Project Structure


You probably have noticed a kind of correlation between the three IDEs. Now the question still triggers, where should you save your database in any IDE’s Java Project?

The solution on Where You Should Save Your Database in any Java Project

If you are developing any serious java application, you’re probably using any of the above IDEs. The Ideal Location to save your database should be in the same directory as src. Your database file should be contained in the main project directory. This should be applied to all three IDEs (Eclipse, NetBeans and IntelliJ IDEA).

Have a look at the Screenshots below

The following screenshots show a file structure for the 3 IDEs with the database. The screenshots represent Eclipse IDE, NetBeans IDE, and IntelliJ IDEA respectively.

Database location in Eclipse IDE


Database location in NetBeans IDE



Database location in IntelliJ IDEA


Similar Posts