You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Provide a way to specify -source and -target for javac with VScode #982
Visual Studio Code version: Version 1.35.1 (1.35.1)
Java extension version: Language Support for Java(tm) 0.46.0
Steps To Reproduce
Allow VScode to build a project. JDK11 is installed and found on path, and is used for builds. Classes generated have class target 55.0
I want to have them generated with target version 52.0 (Java 1.8)
That is, I'd like to be able to pass -source and/or -target to the invocation of javac (or logical equivalent) Could not find any setting or configuration or documentation.
Reacted by Andreas Fertsch-Röver and Raphael Wettinger
Unfortunately we're not using those - a custom build system based on ANT. Builds using "our" build system are correctly setting -source,-target but when VScode compiles the files (because of changes) they get generated with an inconsistent target version. Do you know an appropriate setting in the "eclipse" .classpath or .project? We are generating those so that vscode understands our dependencies and such.
changed the title [-]Question: Is there a way to specify -source and -target for javac with VScode[/-][+]Feature request: Provide a way to specify -source and -target for javac with VScode[/+]on Jul 12, 2019
Approved methods to set source and target versions is to either use maven, gradle, or to add a .settings/org.eclipse.jdt.core.prefs file to your project to let them know your desired settings.
Activity
fbricon commentedon Jul 12, 2019
Your best best for now is to use Maven or Gradle to define source/target
marvingreenberg commentedon Jul 12, 2019
Unfortunately we're not using those - a custom build system based on ANT. Builds using "our" build system are correctly setting -source,-target but when VScode compiles the files (because of changes) they get generated with an inconsistent target version. Do you know an appropriate setting in the "eclipse" .classpath or .project? We are generating those so that vscode understands our dependencies and such.
[-]Question: Is there a way to specify -source and -target for javac with VScode[/-][+]Feature request: Provide a way to specify -source and -target for javac with VScode[/+]marvingreenberg commentedon Jul 12, 2019
I changed this to a feature request, since that seems reasonable.
fbricon commentedon Jul 12, 2019
In that case you need to generate .settings/org.eclipse.jdt.core.prefs files containing
robstryker commentedon Nov 2, 2026
Approved methods to set source and target versions is to either use maven, gradle, or to add a
.settings/org.eclipse.jdt.core.prefsfile to your project to let them know your desired settings.closing the issue now.