Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the project directory structure for a standalone Java SE application?

What is the standard project directory structure of a standalone Java SE (Command Line based) application?

src folder will contain all my .java files in properly organized packages. Other than that I have bin folder which will contain my .class files.

I've Properties files and XML configuration files in my project. In which directory should I place them? Should I create a package named com.myproject.config and place all the .xml config files in that?

I want the dependent jars to be packaged along with my final package. So should I create a folder (say by the name lib) to hold all these .jar files?

like image 612
HariShankar Avatar asked Jun 12 '12 07:06

HariShankar


2 Answers

I would recommend to stick with default Maven layout ( and also use maven as build tool )

Productive classes / resources:

src/main/java
src/main/resources

Test data and classes:

src/test/java
src/test/resources

Maven can also take care to package your application properly with all the necessary jars ( look for maven assembly plugin )

like image 193
Konstantin Pribluda Avatar answered Nov 01 '22 02:11

Konstantin Pribluda


src/com.enterprise_name.project_name. Main.java (the main class)

src/com.enterprise_name.project_name.model.(here all model classes)

src/com.enterprise_name.project_name.view.(here all view classes, JFrame, Jdialog,etc)

src/com.enterprise_name.project_name.view.resources.(here all the files and images used in the views *note)

src/com.enterprise_name.project_name.controller.(here all controller classes)

lib/(here all the external libraries - dont forget add to build path)

*note if you need some resource file (xml, config file, etc) create a package .resources. in the specific place where do you need (model, controller, view)

like image 35
Musculaa Avatar answered Nov 01 '22 01:11

Musculaa