Reputation: 31
I have implemented the Java QuickStart for the Classroom API and am getting an error message "java.io.FileNotFoundException: Resource not found: /credentials.json" at run-time. I copied my credentials.json file to the Project res directory, but continue to get this error. Any suggestions?
Upvotes: 3
Views: 6666
Reputation: 604
There are two steps needed to find the resource in Eclipse:
https://stackoverflow.com/a/46950488/10850340
Upvotes: 1
Reputation: 25
The name of your file has to be credentials only, if you have credentials.json as the name of your file in your folder you will get this error.
Upvotes: 0
Reputation: 51
I tried it in a different way than I found on other websites, and it worked for me.
replace below code:
InputStream in = GoogleSheetAPIHandler.class.getClass().getResourceAsStream(CREDENTIALS_FILE_PATH);
With this code:
InputStream in = new FileInputStream(CREDENTIALS_FILE_PATH);
Upvotes: 5
Reputation: 85
You need to import credential.json file into the src/main/resources folder in eclipse. You may be included in the project folder. But you need to import it into eclipse.
Upvotes: 1