Java

Learn how to build and run Java applications on Codesphere.

Java is a programming language and computing platform used for creating and running applications.

Using Java in Codesphere

Java does not come pre-installed in Codesphere. You can however install & use Java with one of the following options.

Option 1: Use our java spring boot template

Option 2: Add a maven wrapper (run mvn -N wrapper:wrapper locally) to your repo and set the following steps in the CI pipelineCI pipeline setup

Step Command
Prepare - Install java nix-env -iA nixpkgs.jdk19 [set desired jdk version]
Prepare - mvn generate-sources JAVA_HOME="$(readlink -e $(type -p javac) | sed -e 's/ \/ bin \/ javac//g')" ./mvnw install generate-sources -DskipTests
Run - mvn spring-boot:run JAVA_HOME="$(readlink -e $(type -p javac) | sed -e 's/\/bin\/javac//g')" ./mvnw spring-boot:run

Other Java distribution i.e. Java Quarkus can be installed using the provided CLI installation for Linux: https://quarkus.io/get-started/

In case you have any issues Please fill out the contact form to set up a consultation with one of our solution engineers or head over to our Discord community to get help.