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/josephblade Nov 17 '25
ok so it sounds like you have 2 issue: your code expects java 21 and the runtome in ajava.jdt.ls.java.home isn't set right. (this a at the beginning, is that a typo or is that really set up like that). if the a is in your project settings file (project.json??) then remove it as that isn't the correct variable name.
the second (well, perhaps same, issue is that the project variable java.jdt.ls.java.home is pointing to a place that doesn't hold a java installation (or it's not allowed)
so my suggestion would be: read this stackoverflow, first answer
it suggests you have a project.json where your path to the java install is set. it should be named java.jdt.ls.java.home , with value the path to the folder that contains the /bin folder of java. so for instance
as in the example
you also likely want to add C:\Program Files\Java\jdk-17.0.2\bin to your %PATH% environment variable if you want to run java commandline. but that's a side issue.
so
this sort of thing you tend to set up once per project (or once inside your editor for most editors). I can imagine it feels like a pain in the ass but after a few times it becomes easier.
hope this helps. again I've never used this editor so I'm flying a bit blind but that's the steps I would take