code 搭建java_VSCode搭建java开发环境

VSCode搭建java开发环境

1:在 Visual Studio Code 中打开扩展视图(Ctrl+Shift+X),输入关键词java、spring分别下载Java开发插件包和springboot插件包

c5c29830fd8a457dc9c0cd38558f9e98.png

7a7001cfbedfee4a11b1f3ae7e7a7690.png

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,接下来就是一步一步创建项目了

4413d11b94b690997f3e0ff1bf760e97.png

81b5a3e903daf8b6f205c6fa551f6a9c.png

4:项目创建好以后,修改启动参数(调试->打开配置文件 ->launch.json)中的主类,然后F5就可以运行了

48304ba5e6f9fe08f3fa1abda7d326ab.png

{

// 使用 IntelliSense 了解相关属性。

// 悬停以查看现有属性的描述。

// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387

"version": "0.2.0",

"configurations": [

{

"type": "java",

"name": "Debug (Launch)-DemoApplication",

"request": "launch",

"cwd": "${workspaceFolder}",

"console": "internalConsole",

"stopOnEntry": false,

"mainClass": "com.example.demo.DemoApplication",

"args": "",

"projectName": "demo"

}

]

}

48304ba5e6f9fe08f3fa1abda7d326ab.png

然后F5就可以运行了

5c83b5841590d6c20fe10ffa9a361dd0.png

你可能感兴趣的:(code,搭建java)