Easy to use Java project structure for easy compilation and execution
📚 Learn more about this template in the wiki!
Prerequisites
- Java installed on your computer
- GitHub Desktop
Setting up
- Create your own repository based on this example by clicking on Use this template green button
- Clone your newly created repository on your computer, by clicking the Clone or download green button, and Open in Desktop. Then follow the instructions given by GitHub Desktop
- You should now have on your computer a folder named after your repository. Take a look at the Java source files in the
src/main/java
directory. That's where you will write your code!
You can open the Java files in src/main/java
directory in your favorite editor and compile them as you usually do.
You can also open a terminal at the project root (at the same location of this README) and run the following commands:
Command | Purpose |
---|---|
./gradlew assemble |
Compile your project |
./gradlew run --console=plain |
Compile and run your app |
./gradlew clean |
Delete compiled classes |
Running one of these commands might take a while the first time you do it, but that will be the case only once!
You can enjoy a great coding experience in Visual Studio Code, a free text editor with additionnal features that will help you work on your project!
You will need to install the Java extension for Visual Studio Code. To do so, click on the "Extensions" icon in the left bar, and search for vscjava.vscode-java-pack
, and install the extension.
Then open the whole project folder in Visual Studio Code. You will be able to see compilation errors and useful information as you type! You can compile and run your app simply by pressing F5.
You should not worry about the other files, they are the ones that manages compilation and execution for you. You should not edit these files by yourself. All your work will be in the src/
folder, that stands for "source".
That should be enough to get you started! If you have any questions, reach out by creating an issue ticket in this repo!