---
title: "sonar 配置服务默认路径问题"
author: "simon_zhang"
date: "2017-01-05T16:38:48Z"
tags: []
categories: ["开源软件"]
slug: "sonar"
draft: false
lastmod: "2017-01-05T16:35:17Z"
id: 2349005
url: "https://mogee.iteye.com/blog/2349005"
---

sonar 配置后台服务时，出现“Temp directory is not writable” 问题解决：  
`WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: Temp directory is not writable: C:\Windows\system32\config\systemprofile\AppData\Local\Temp\ java.lang.IllegalStateException: Temp directory is not writable: C:\Windows\system32\config\systemprofile\AppData\Local\Temp\ at org.sonar.process.MinimumViableSystem.checkWritableDir(MinimumViableSystem.java:60) at org.sonar.process.MinimumViableSystem.checkWritableTempDir(MinimumViableSystem.java:52) at org.sonar.process.MinimumViableSystem.check(MinimumViableSystem.java:45) at org.sonar.application.App.main(App.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240) at java.lang.Thread.run(Thread.java:619) Caused by: java.io.IOException: 系统找不到指定的路径。 at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.checkAndCreate(File.java:1704) at java.io.File.createTempFile(File.java:1792) at org.sonar.process.MinimumViableSystem.checkWritableDir(MinimumViableSystem.java:57) ... 9 more <-- Wrapper Stopped The SonarQube service was launched, but failed to start.`  
解决办法如下：

在conf目录找到wrapper.conf文件，打开。  
在“wrapper.java.additional.1=-Djava.awt.headless=true”下增加  
`###set temp dir ,solve Temp directory is not writable wrapper.java.additional.2=-Djava.io.tmpdir=../../temp`