How to set GOOGLE_APPLICATION_CREDENTIALS on Java Snippet

Hi,

Currently I create tools to extract text from image on local disk using google vision,
It work on Python Script Node by using Conda Environment Propagation.

Its hard to use in Java (Java Snippet Node), how to set GOOGLE_APPLICATION_CREDENTIALS in Java (Java-Snippet-Node) by hard wired?
The existing Authentication Node: Google-Authentication-Node and Google-Authentication-(API Key)- Node only use for Google-Sheet-Node, Google-Drive-Node, and Google-Cloud-Storage. Not for Java-Snippet-Node.

Thanks in advanced!
Anwar

Hi there @athoyib

Any chance you can show us your java snippet node?

You are correct about the google authentication nodes. But you might be able to use google vision with java with a service account – have you had a look at Authenticating as a service account  |  Authentication  |  Google Cloud ?

Best wishes
Ana

KNIME_project_ocr.knwf (3.4 MB)
Sure Ana,

Kindly find the workflow attached.

Thanks!
Anwar

Hi @athoyib

Sorry for the delay

I think the best way of achieving what you want is to follow the guide I provided previously, and make use of service accounts.

Here is one example of how it can be done using python, you can adapt it to your java code: Image_colour_label – KNIME Hub

Cheers
Ana

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.