vs code 配置java环境
2017-05-19 本文已影响1636人
疯狂的冰块
vs code 配置java环境,并且利用powershell的特性完成了程序运行时间的计算,秒为单位,保留小数点后7为
ctrl+sheft +p
输入tasks:选择configure task runner,将一下代码贴到tasks.json
这样就可以来运行java程序了,ctrl+F9
注意:
由于如果你想是javap 汇编出java程序,你可以
将如下
"$start=Get-Date;javac ${file} ; java ${fileBasenameNoExtension} ; $end=Get-Date; ('[Finished in ' + ($end - $start).TotalSeconds+ ' s]')"
换为:
"$start=Get-Date;javac ${file} ; javap -v ${fileBasenameNoExtension} ; $end=Get-Date; ('[Finished in ' + ($end - $start).TotalSeconds+ ' s]')"
{
"version": "0.1.0",
"command": "powershell",
"isShellCommand": true,
"showOutput": "always",
"args": [
"/C"
],
"tasks": [
{
"taskName": "javap",
"isShellCommand": true,
"isBuildCommand": true,
"suppressTaskName": true,
"args": [
"$start=Get-Date;javac ${file} ; java ${fileBasenameNoExtension} ; $end=Get-Date; ('[Finished in ' + ($end - $start).TotalSeconds+ ' s]')"
],
"showOutput": "always"
},
{
"taskName": "java",
"command": "java",
"isShellCommand": true,
"isBuildCommand": true,
"args": [
"${fileBasenameNoExtension}"
],
"showOutput": "always"
},
{
"taskName": "javac",
"command": "javac",
"isShellCommand": true,
"isBuildCommand": true,
"args": [
"${file}"
],
"showOutput": "always"
}
]
}