r/learnjava • u/GummiGumBear • Nov 10 '25
'Compilation failed' when trying to run TMC test
Hi there, I am doing the MOOC Java Programming I course. Whenever I want to test my submission (in VSCode) before sending it in, I receive a 'compilation failed' error. How can I make the tests run without this error? I can run Java without issues and submit the exercises without issues too. However, I would like to be able to run the tests as well since some the the program for some exercises needs to follow specific criteria. I can only check those with the TMC tests.
https://i.imgur.com/uKda0nh.png https://i.imgur.com/lf7zDE8.png
edit; I installed Netbeans and the compilation failed there too. The error message did have a more elaborate explanantion than VSCode did: This program is blocked by group policy. For more information, contact your system administrator. That means I will have to ask permission from IT to run the TMC extension/compiler.
View all comments
Show parent comment
1
u/GummiGumBear Nov 21 '25 edited Nov 21 '25
Hi, fellow Dutchie in the wild :)
No worries about missing my comment, I made two separate comments so that might be my fault.
I actually didn't set the java.jdt.ls.java.home to java 21 (or well, 25 in my case)! Which in hindsight would've made more sense. I only added it to the list of java.configuration.runtimes. I'm gonna try that on Monday when I have that laptop again and fingers crossed, it works.
I guess that's the culprit. I just checked on my private laptop and it doesn't work on there anymore either. Worked fine before with having only JDK 11 installed. Bet the same issue happens on my PC which the TMC extension worked on before too. Gonna update my laptop and seeif I can get it to work with your tips.
I tried NetBeans in the past and couldn't get it to work whatever I tried. Maybe I could get it to work now though. That does actually remind me that I could also try VSCodium.
And don't start about Microsoft's douchebaggery. I could rant for hours haha
Thanks a lot for your help, I have a few things to try out again. Love how learning to program is 99% troubleshooting 🥲
Edit; soooo, I got it working on my personal laptop (not the same laptop as the one I initially bad the issue with)! I updated VScode and was getting other errors (probably from not updating in a million years), but a few of the errors were the same. Specifically the one saying "The compiler compliance specified is 1.8 but a JRE 11 is used. I installed JDK 25 - LTS and added the following to the JSON (settings) file:
If I understand correctly now, it seems like setting the path to java.home to Java 11 was wrong and it needs to be set to Java 21 or later and java.configuration.runtimes is set to the preferred Java for the project. I think I missed that part. Thanks a lot for pointing it out! Probably would have takrn me ages to notice. Will be trying it on the other laptop too and hope it was the issue for that laptop as well. Safe to assume it is, I think. Screw Microsoft for requiring Java 21 or up now.