Repository navigation
Force javac instead of eclipse jdt as compiler #3007
Description
Hey, i'm using visual studio code with the "extension pack for java" extension.
Local i have installed java 17 (microsoft edition).
When i build my project with mvn -U clean install there will be classes generated and everything is fine.
But when i press shift + alt + B like your readme says, the code will be compiled with the eclipse jdt compiler, which seems to have problems with a dependecy called MapStruct.
Here is one file compiled with maven:

And here is the same file after pressing shift + alt + B:

Have a look at line 20.
When i start my project the java extension always recompile my code (with the eclipse compiler).
I disabled the auto build feature, but that changed nothing.
I also configured the runtimes for java 17 in hope that this version will be used for compiling my code, but it doesn't.
Here is a repository i created to reproduce the error: Repository
Here are also some settings of vscode:
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.debug.settings.onBuildFailureProceed": true,
"java.autobuild.enabled": false,
"java.debug.settings.forceBuildBeforeLaunch": false,
"java.jdt.ls.java.home": "C:\\Program Files\\Microsoft\\jdk-17.0.5.8-hotspot",
"spring-boot.ls.java.home": "C:\\Program Files\\Microsoft\\jdk-17.0.5.8-hotspot",
"java.compile.nullAnalysis.mode": "disabled",
"java.configuration.runtimes": [
{
"name": "JavaSE-17",
"path": "C:\\Program Files\\Microsoft\\jdk-17.0.5.8-hotspot",
"default": true
}
]
}
Environment
- Operating System: Windows 10
- JDK version: 17 (microsoft edition)
- Visual Studio Code version: 1.76.2 (user setup)
- Java extension version: 1.16.0
Steps To Reproduce
- Clone my test repository
- Run
mvn -U clean installin the terminal - Have a look at the generated source file
TestMapperInterfaceImpl.javaon line 20 (the setter) - Press
shift + alt + Bto compile the project - Have a look at the same file and you will notice that the setter is gone
Test repository: Link to the repository
Current Result
The eclipse jdt compiler messed something up so the generated files are not working.
Expected Result
The compiler i defined in the runtime settings should be used to compile my code.
Additional Informations
I also opened a issue at the microsoft/vscode-spring-dashboard extension because i first thought that the error is a problem ob this extension because i started my project over this extension. But i noticed that before it starts it will be recompiled.
Link to the issue of the spring boot extension
Activity
snjeza commentedon Mar 20, 2023
The issue is not related to eclipse jdt compiler.
@dawosch Could you try the following:
TestMapperInterfaceImpl.java
See https://github.com/dawosch/vscode-java-extension-compiler-error/blob/main/app/pom.xml#L54
dawosch commentedon Mar 21, 2023
Thanks for your answere.
Yes this seems to work fine.
But i'm wondering why the language server needs to recompile all files.
When i have java installed and all settings point to my java version, i would expect that the language server will use this java version to.
snjeza commentedon Mar 22, 2023
The issue is related to the Java Service Provider. The provider configuration have to be packed into a jar file.
See https://docs.oracle.com/javase/tutorial/ext/basics/spi.html#package-in-jar-files
rgrunber commentedon Jul 16, 2025
Closing this as it seems to have a solution. Also FWIW, we support
javac-based compilation as well now : https://github.com/redhat-developer/vscode-java/wiki/Javac%E2%80%90based-compilation-support .