vs code 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": "/usr/local/lib/jdk1.8.0_172", ###必需

"editor.fontSize": 15,

"editor.lineHeight": 30,

"maven.executable.path": "/usr/local/bin/apache-maven-3.5.4/bin/mvn", ###必需 "java.configuration.maven.userSettings":"/usr/local/bin/apache-maven-3.5.4/conf/settings.xml", ###必需

"maven.terminal.customEnv": [

{

"environmentVariable": "JAVA_HOME", ###必需

"value": "/usr/local/lib/jdk1.8.0_172"###必需}

],

"terminal.integrated.shell.linux": "/bin/bash",

"java.jdt.ls.vmargs": "-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication",

"explorer.confirmDelete": false

}

3:新建项目:打开命令窗口(Ctrl+Shift+P),输入spring,接下来就是一步一步创建项目了

vs code java 开发_VsCode搭建Java开发环境_第1张图片

vs code java 开发_VsCode搭建Java开发环境_第2张图片

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

{

// 使用 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"

}

]

}

然后F5就可以运行了

vs code java 开发_VsCode搭建Java开发环境_第3张图片

结束

你可能感兴趣的:(vs,code,java,开发)