NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Importing Google Translate API .jar files into libraries ????

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
dazz



Joined: 21 Mar 2017
Posts: 1
Location: New Zealand

PostPosted: Wed Apr 12, 2017 3:50 am    Post subject: Importing Google Translate API .jar files into libraries ???? Reply with quote

Hello
I am new to Netbeans.
I am trying to setup the Google translate API.
This requires importing the Google API .jar files. These files are available here https://developers.google.com/api-client-library/java/apis/translate/v2

The problem I have is that I can't set up Netbeans to "see" the library files.

To do this I have setup a new project called Translate. This setup the standard directory tree as follows:

Translate
lib
<google .jar files>
nbproject
src
translate
<source code.java file>
test

The "translate" folder holds the source code for the translation code I have written.
The code starts with

Code:
package translate;

// Imports the Google Cloud client library
import com.google.cloud.translate.Translate;
import com.google.cloud.translate.Translate.TranslateOption;
import com.google.cloud.translate.TranslateOptions;
import com.google.cloud.translate.Translation;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
//import java.io.PrintWriter;

public class Translate_Chinese_to_English {
  public static void main(String[] args) throws Exception {...


Netbeans says the google imports do not exist.


The "lib" folder holds the google .jar files. These include:
google-api-services-translate-v2-rev49-1.22.0.jar
google-api-services-translate-v2-rev49-1.22.0.properties
google-api-services-translate-v2-rev49-1.22.0-javadoc.jar
google-api-services-translate-v2-rev49-1.22.0-sources.jar
Generic Java

The instructions say:
General purpose Java 5 applications require the following jar files, or newer compatible versions, from the libs folder:

google-api-client-1.22.0.jar
google-oauth-client-1.22.0.jar
google-http-client-1.22.0.jar
google-http-client-jackson2-1.22.0.jar
commons-logging-1.1.1.jar
gson-2.1.jar
httpclient-4.0.1.jar
httpcore-4.0.1.jar
jackson-core-asl-1.9.11.jar *
jackson-core-2.1.3.jar
jsr305-1.3.9.jar
protobuf-java-2.4.1.jar
xpp3-1.1.4c.jar *

( These are also in the Netbeans lib folder but * are not included in zip file)

I select the "Translate" project and right click, select properties.
Select Libraries.
Select Add JAR/Folder
Select the jar files above (relative path).
Click OK.


Netbeans still says the google imports do not exist.
Can anyone see what I am doing wrong???
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo