Trying to get Translate API running with Netbeans ??

180 views
Skip to first unread message

Darren Conway

unread,
Apr 13, 2017, 9:10:57 AM4/13/17
to Google Cloud Translation API

Hello

I am new to Java, Netbeans and the Translate API.  I have written code to read in a file, look line by line looking for Mandarin characters. Those lines should be sent for translation.

The problem is that I Netbeans can't find some of the import Google .jar files.  They are all in the same folder. I have tried to follow the Google instructions to include the right ones.

I have a Google account and an API Key and this is loaded into my Win10 environment.

The top image is based on a Stackoverflow sample that compiles, but returns a fist full of errors when run.

The last image is of the application I actually want to run.  I have heavily modified to selectively translate a file line by line.
Netbeans says it can't find the imports with red dots beside them.

Any pointers would be much appreciated.

Dazz

Nicholas (Google Cloud Support)

unread,
Apr 20, 2017, 12:17:08 PM4/20/17
to Google Cloud Translation API
Hey Dazz,

Welcome to this group.

From the last screenshot you provided, it seems your getting an error with your import statements.  Not knowing what the exact error is, I can only assume it's likely a missing jar.  Also, given the description and screenshot, it seems like you're using the Translate API Client Library for Java while trying to import the classes from the Google Cloud Client Library for Java.  I would recommend adding that library to your project and ensure your code conforms to the APIs in the linked documentation.

Also, explicitly posting the errors, dependencies and code may be more helpful to the community as screenshots can be limiting in this context.
Reply all
Reply to author
Forward
0 new messages