templates icon indicating copy to clipboard operation
templates copied to clipboard

java template does not set JAVA_HOME correct

Open gmuth opened this issue 9 months ago • 2 comments

The template uses ms openjdk and adds support for mvn and gradle via the java feature.

{
	"name": "Java",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/java:1-21-bullseye",

	"features": {
		"ghcr.io/devcontainers/features/java:1": {
			"version": "none",
			"installMaven": "true",
			"installGradle": "true"
		}
	}
}

The container than has JAVA_HOME pointing to /usr/local/sdkman/candidates/java/current which does not exist. MS jdk is installed at /usr/lib/jvm/msopenjdk-current/bin/java

$ mvn 
The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.

gmuth avatar Jun 02 '25 20:06 gmuth

Show more

anninhaspeck avatar Jun 13 '25 00:06 anninhaspeck

https://containers.dev/guide/dockerfile

Ruiizgaby4 avatar Jul 25 '25 10:07 Ruiizgaby4