diff --git a/java/README.md b/java/README.md index fdc1035082fa544cbf77ed1c63c6503e804675d3..252841fd619bc94bfc55b97cee4c7720ee577f55 100644 --- a/java/README.md +++ b/java/README.md @@ -7,18 +7,38 @@ Where install jdk, path to java and javac In order to be able to compile and run Java code, you need to install a JDK (Java Development Kit) on your computer. A JDK contains a java compiler (`javac`) and a java interpreter (`java` - JRE = Java Runtime Environment). -You can find JDKs at https://openjdk.org/install/ (latest JDK at https://jdk.java.net/). -If you are using Linux or MacOS, you should install a JDK using your package manager (apt, brew, ...). +Recommended JDK for windows : https://adoptium.net/temurin/releases/?os=windows&arch=x64&package=jdk. + +You can find other JDKs at https://openjdk.org/install/ (latest JDK at https://jdk.java.net/). + +**If you are using Linux or MacOS, you should install a JDK using your package manager** (apt, brew, ...). ### Commands -How this project is configured + the commands +In this template project, we have chosen the following points : + +- use `src/` as the source directory (containing all java files) +- use `out/` as the output directory (containing all compiled `.class` files) +- use `src/Main.java` as the main file of the java program -TODO : for Windows in particular, because there is no default Makefile support +From this configuration, you can use the following commands in the `java/` folder in order to compile and run your program. + +```bash +javac -sourcepath src -d out src/Main.java # Compile +java -classpath out Main # Run +``` ### Linux / MacOS - Makefile -TODO : how to use the makefile +For OS that support the `make` command, the [`Makefile`](./Makefile) defines some commands to compile, run and clean your project. +You can use it to personalize the project structure. + +```bash +make compile # Compile the project +make run # Run the project +make clean # Clear the output directory +make # Compile, clear terminal and run +``` ## VSCode Project Settings