报错信息:
D:\resource\java_jdk_1.8.261\bin\java.exe -ea -javaagent:C:\Users\镜\AppData\Local\JetBrains\IntelliJIdea2020.2\testAgent\intellij-coverage-agent-1.0.512.jar=C:\Users\镜\AppData\Local\Temp\coverage10args -Didea.test.cyclic.buffer.size=1048576 "-javaagent:E:\tools\IntelliJ IDEA 2020.2\lib\idea_rt.jar=60647:E:\tools\IntelliJ IDEA 2020.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\镜\AppData\Local\Temp\classpath770525232.jar com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 com.faw_qm.erpcg.gld.gld895.service.TestGld895Service
FATAL ERROR in native method: processing of -javaagent failed
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.coverage.main.CoveragePremain.premain(CoveragePremain.java:35)
at com.intellij.rt.coverage.main.CoveragePremain.premain(CoveragePremain.java:28)
6 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at com.intellij.rt.coverage.instrumentation.Instrumentator.performPremain(Instrumentator.java:55)
at com.intellij.rt.coverage.instrumentation.Instrumentator.premain(Instrumentator.java:33)
12 more
Process finished with exit code 1
解决方案: 1.更改window 登录的用户名为英文。(此方法自行百度吧,就不做讲解了)
2.更改idea生成文件的默认路径:
help->Edit Custom VM Options... 中添加 -Djava.io.tmpdir=E:\resource\idea\Temp
注意: 一定要先创建对应的文件夹
既然都更改了临时文件的位置,不如其他的默认路径一起更改了吧:
注意:更改下面的默认路径配置之后,之前的idea插件将全部丢失!!!
1.找到idea安装目录下面的bin文件下的idea.properties
(E:\tools\IntelliJ IDEA 2020.2\bin\idea.properties)
找到:idea.system.path=${user.home}/.IntelliJIdea/system
idea.plugins.path=${idea.config.path}/plugins
更改即可。