2
votes

I downloaded google calendar api sample from http://code.google.com/p/google-api-java-client/source/browse/calendar-cmdline-sample/?repo=samples and created a project in eclipse. Now when i try to run the project am getting java.lang.IllegalArgumentException: no JSON input found at this line

 FileCredentialStore credentialStore = new FileCredentialStore(
        new File(System.getProperty("user.home"), ".credentials/calendar.json"), JSON_FACTORY);

Have any of you tried this example? what is wrong here?

3

3 Answers

1
votes

This error can be resolved by providing input to the .credentials/calendar.json file. If you manually provided the following entry in the calendar.json , it will work :

{
  "installed": {
    "client_id": "client_id",
    "client_secret": "client_secret"
  }
}

It seems to be the Windows problem which is not allowing to set writable permissions on calendar.json file . The method setWritable(boolean,boolean) is returning false and so is the cause of this problem. Still providing json input manually is not a perfect solutions but your application will work.

0
votes

That may happen when your application executed before and it created empty .credentials/calendar.json file in you home dir. That may happen if you're running your application in Windows, cause FileCredentialStore tries to do: file.setReadable(false, false) and fails.

To solve it just remove calendar.json. Although you might have another error: [unable to set file permissions] which I don't know how to solve yet.

-1
votes

Is that project having calendar.json resource file. Please share complete exception stack trace. Seems some required configuration missed from calendar.json file