VSCode搭建java开发环境
1:在 Visual Studio Code 中打开扩展视图(Ctrl+Shift+X),输入关键词java、spring分别下载Java开发插件包和springboot插件包
2:配置参数 点击设置按钮,进入设置选项,配置用户设置(文件->首选项->设置 Ctrl+,)
{ "editor.minimap.enabled": false, "window.zoomLevel": 0, "workbench.iconTheme": "vscode-great-icons", "workbench.editor.enablePreview": false, "workbench.editor.enablePreviewFromQuickOpen": false, "editor.renderIndentGuides": false, "editor.highlightActiveIndentGuide": false, "java.home": "D:/apply-install/jdk/install", //必需
"editor.fontSize": 15, "editor.lineHeight": 30, "maven.executable.path": "D:/apply-install/maven/apache-maven-3.6.2/bin/mvn", //必需
"java.configuration.maven.userSettings": "D:/apply-install/maven/apache-maven-3.6.2/conf/settings.xml", //必需
"maven.terminal.customEnv": [ { "environmentVariable": "JAVA_HOME", //必需 "value": "D:/apply-install/jdk/install" //必需
} ], "terminal.integrated.shell.linux": "/bin/bash", "java.jdt.ls.vmargs": "-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication", "explorer.confirmDelete": false }
3:新建项目:打开查看-》命令面板(Ctrl+Shift+P),输入spring,接下来就是一步一步创建项目了
4:项目创建好以后,修改启动参数(调试->打开配置文件 ->launch.json)中的主类,然后F5就可以运行了
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "java", "name": "Debug (Launch)-DemoApplication<demo>", "request": "launch", "cwd": "${workspaceFolder}", "console": "internalConsole", "stopOnEntry": false, "mainClass": "com.example.demo.DemoApplication", "args": "", "projectName": "demo" } ] }
然后F5就可以运行了