我正在使用我从https://developers.google.com/gmail/api/quickstart/java获得的源代码 当我在日食中运行时,我收到错误
Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.<init>(Unknown Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at googleemailid.GmailQuickstart.authorize(GmailQuickstart.java:79)
at googleemailid.GmailQuickstart.getGmailService(GmailQuickstart.java:101)
at googleemailid.GmailQuickstart.main(GmailQuickstart.java:109)
InputStream in =GmailQuickstart.class.getResourceAsStream("E:\\client_secret.json");
GoogleClientSecrets clientSecrets =
GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
出现错误 GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY,new InputStreamReader(in));
为了进行调试,我尝试使用InputStream读取文件,并且能够读取文件和文件,并且具有完全权限。我也得到了以下警告。
Jun 08, 2015 5:45:43 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for everybody: C:\Users\Abc\.credentials\gmail-api-quickstart
Jun 08, 2015 5:45:43 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for owner: C:\Users\Abc\.credentials\gmail-api-quickstart