受够了这个错误访问被拒绝(java.io.FilePermission \images\849cfc1ab7e594e7dba28cfdf37cf9bea87c5de2-privatekey.p12 } 在谷歌应用引擎中使用驱动器 api
我正在尝试使用服务帐户访问驱动器 api。我从 https://developers.google.com/drive/service-accounts编写代码。
但是,在最后一行访问文件@ FIle Reading time 时,我总是遇到此错误。这是代码
HttpTransport httpTransport = new NetHttpTransport();
JacksonFactory jsonFactory = new JacksonFactory();
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(DriveScopes.DRIVE)
.setServiceAccountPrivateKeyFromP12File(
new java.io.File(SERVICE_ACCOUNT_PKCS12_FILE_PATH))
.build();
Drive service = new Drive.Builder(httpTransport, jsonFactory, null)
.setHttpRequestInitializer(credential).build();
请建议....