vscode配置java环境变量_配置jre环境变量

2022-11-09 17:41:07 浏览数 (1)

原因

  • Idea启动慢,过于冗杂,VsCode很轻量
  • 有时需要启动前端代码,不想使用Idea
  • 逃离Idea的激活成功教程版魔咒,哈哈哈
  • 最近在学Rust,Idea对Rust的支持不是很好

建议大家还是看看,里面有比较完备的介绍 官方文档

插件

  • Extension Pack for Java
    • 只用下载第一个,其他的会自动下载
    • Language Support for Java有点坑,这个得要Java 11才行,官网上没看到他们说的0.6.x的历史版本
    • 不过不影响使用Java 1.8
  • Spring Boot Extension Pack
    • 这也是个全家桶

插件设置

  • Ctrl Shift P,输入setting,选择JSON
代码语言:javascript复制
{ 

"java.jdt.ls.vmargs": "-XX: UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -javaagent:"c:\Users\15881\.vscode\extensions\gabrielbb.vscode-lombok-1.0.1\server\lombok.jar"",
"java.configuration.runtimes": [
{ 

"name": "JavaSE-1.8",
"path": "D:/Dev/jdk1.8.0_191",
"default": true  //默认使用这个
},
{ 

"name": "JavaSE-11",
"path": "D:/Dev/jdk-11.0.15.10-hotspot"
}
],
"redhat.telemetry.enabled": true,
"spring.initializr.defaultLanguage": "Java",
"spring.initializr.defaultJavaVersion": "8",
"spring.initializr.defaultPackaging": "JAR",
"java.configuration.maven.globalSettings": "D:\Dev\apache-maven-3.5.0\conf\settings.xml", //maven setting.xml路径,里面可以指定maven下载依赖的保存路径
"java.maven.downloadSources": true,
"java.maven.updateSnapshots": true,
"maven.dependency.enableConflictDiagnostics": true,
"maven.settingsFile": "D:\Dev\apache-maven-3.5.0\conf\settings.xml", //感觉和上面差不多,还是都设置了吧
"spring-boot.ls.java.home": "D:/Dev/jdk1.8.0_191",
"window.zoomLevel": 2,
"java.codeGeneration.generateComments": true,
"java.codeGeneration.useBlocks": true,
"java.completion.guessMethodArguments": true,
"java.debug.settings.forceBuildBeforeLaunch": false,
"java.debug.settings.hotCodeReplace": "manual",
"java.templates.typeComment": [
"/**",
" * Roushan",
" * ${year}/${month}/${day} ${time}",
" */"
]
}

配置启动文件

  • 配置项目启动Profile
代码语言:javascript复制
{ 

// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{ 

"type": "java",
"name": "Launch Current File",
"request": "launch",
"mainClass": "${file}"
},
{ 

"type": "java",
"name": "Launch AppRun",
"request": "launch",
"mainClass": "xx.xxxxxx.xxxxxRun",
"projectName": "xxxxxxx",
"args": "--spring.profiles.active=local", //选择1
"vmArgs": "-Dspring.profiles.active=xxx" //选择2
}
]
}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/186154.html原文链接:https://javaforall.cn

0 人点赞