java.io.FileNotFoundException: Resource not found: /credentials.json on Java QuickStart for Classroom API - credentials

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?

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);

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.
locate your credentials.json file in the folder.
click and drag it
drop it in src/main/resource and click ok.
After importing into eclipse it should show like the below image.

There are two steps needed to find the resource in Eclipse:
To have the file in the resources folder
Create the resource folder (if it does not exist): src/main/resouces
Add the credential file to the resource folder: src/main/resouces/credential.json
To have the resources folder in the Source Java Build Path
Go to Eclipse Path Source: Project > Properties > Java Build Path > Source (tab)
Add resources folder: Add Folder ... (button) > resources (check box) > OK (button)
https://stackoverflow.com/a/46950488/10850340

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.

Related

How to get filepath of a file in Azure Service Fabric

I have a project which is in an Azure Service Fabric Solution. How can I get specific full filepath of a content file? The content file is in the same folder with my source code.
What I tried:
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location
But it turns out:
C:\SfDevCluster\Data_App_Node_4\ABCXYZType_App126\ABCXYZPkg.Code.1.0.0\ABCXYZ.dll
This is a file in bin/debug folder
To get the location of content files you can use:
var path = Path.Combine(
FabricRuntime.GetActivationContext().GetCodePackageObject("Code").Path,
"Readme.txt");
ServiceEventSource.Current.ServiceMessage(this.Context, File.ReadAllText(path));
provided that the file Readme.txt has the Build Action is set to "Content" and the Copy to Output Directory setting is set to something else than "do not copy".

"RegisterPlugin" task was not found in CRM 2011

i am trying to deploy the crm project, I am getting following error.
'Error 105 The "RegisterPlugin" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild\12.0\bin" directory. <file path\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets 176 4 <path>.CrmPackage'
I have tried the solution https://community.dynamics.com/crm/b/crmbusiness/archive/2014/01/22/crm-2011-error-registering-plugins-and-or-workflows-the-resource-string-errorserializingregfile-for-the-registerplugin-task-cannot-be-found
but no luck. any other clue?
Thank you
JK
That error means you have a MSBuild step to run "RegisterTask" task but that Task wasn't defined in the tasks file (path\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets) (there should be some sort of which references "RegisterPlugin"), OR, the process can't read from that folder (permissions) or the folder doesn't exists.

Access files from project folder in UWP

in my solution I have backgroundtask project which has a "Resources" directory. How can I acess the files of this directory?
I already tried
auto loader = Windows::ApplicationModel::Resources::ResourceLoader::GetForViewIndependentUse();
and I get a "ResourceMap Not Found" error.
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::Storage::StorageFolder^ installedLocation = package->InstalledLocation;
this should return the Folder of your project that contains your "Resources" folder.

Java.nio.Files "createSymbolicLink" erases target dir contents?

I want to create a link from my webapp to a directory on the server.
I'm using the following code:
java.nio.file.Path link = Paths.get(dirInMyApp);
java.nio.file.Path target = Paths.get(dirOnTheServer);
Files.createSymbolicLink(link, target);
This works, but seems to have a strange side effect: If "dirOnTheServer" had files in it, it will be empty after the link is created!
Also, I can use the link from my app and add files to the "dirOnTheServer" directory, but if I redeploy my app, it's empty again.
Actually createSymbolicLink does not empty the directory - undeploying a webapp from tomcat with such links will.
This can be prevented by deleting the link when the webapp is being undeployed.

How to access resource editor file to Netbeans

How to access resource editor file to Netbeans?/How resource editor files are imported and opened in Netbeans?Detailed description.
Ok for open the .res file from code, you need to use this lines:
try{
Resources.open("/myResFile.res");
catch(IOException ioe){
//manage the exception
}
The path for your .res file will be different, in my example is like it would be in the src folder.

Resources