r/javahelp • u/Federal-Dot-8411 • Nov 28 '25
JAVA_HOME not being detected in Makefile
Hello, so I have this makefile:
PROJECT_DIR=./tomcat/ServerUbicua
COMPOSE_FILE=docker-compose.yaml
.PHONY: all build up down clean
all: build up
build:
cd $(PROJECT_DIR) && mvn clean install
up:
docker compose -f $(COMPOSE_FILE) up -d
down:
docker compose -f $(COMPOSE_FILE) down
clean:
cd $(PROJECT_DIR) && mvn clean
docker compose -f $(COMPOSE_FILE) down --volumes --remove-orphansBut when I execute the make:
PS C:\Users\karim\Desktop\UNI\PL2-COMPUTACION> make all
cd ./tomcat/ServerUbicua && mvn clean install
The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.
make: *** [Makefile:14: build] Error 1
PS C:\Users\karim\Desktop\UNI\PL2-COMPUTACION>But JAVA_HOME and MAVEN_HOME are correctly setted:
PS C:\Users\karim\Desktop\UNI\PL2-COMPUTACION> make all
cd ./tomcat/ServerUbicua && mvn clean install
The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.
make: *** [Makefile:14: build] Error 1
PS C:\Users\karim\Desktop\UNI\PL2-COMPUTACION> mvn --version
Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
Maven home: C:\Program Files\apache-maven-3.9.11
Java version: 23.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-23
Default locale: es_ES, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
PS C:\Users\karim\Desktop\UNI\PL2-COMPUTACION> java --version
java 23.0.2 2025-01-21
Java(TM) SE Runtime Environment (build 23.0.2+7-58)
Java HotSpot(TM) 64-Bit Server VM (build 23.0.2+7-58, mixed mode, sharing)What is going on ? I am on Windows 11, tried powershell, CMD
2
Upvotes
View all comments
Show parent comment
0
u/blazmrak Nov 30 '25
"Standard tooling" as in something that comes packaged in the JDK. JUnit is "de facto standard", but not standard as in "comes with the JDK".
The Groovy/Kotlin comment was aimed at having to use Gradle to get the dependencies. Technically you don't need to learn the entire language, you are free to copy-paste cluelessly, but even so, you have to learn 2 different build tools that you will encounter, both with oddities.
I don't know what the incorrect assumptions are. JDK doesn't manage dependencies and dependencies are 90% of the reason why you would need to use a build tool, like I said before. It's also incredibly annoying that for each project that I do, I need to set up a giant pom.xml with plugins that should all be tied into a simple command. That is why Veles does all of that without having to configure it, or at least requiring minimal configuration.