Quantcast

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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

dazz
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 *

(* 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???




Loading...