2

I am now going to use the .jar file on http://code.google.com/p/google-api-translate-java/. However, after I download it, I tried to import it in my current project folder (in Eclipse)

the two import statements

import com.google.api.translate.Language; 
import com.google.api.translate.Translate; 

always get complained by the compiler saying couln't find such class

Could any one help on how to correctly import this .jar file into a project in Eclipse?

John Conde
  • 217,595
  • 99
  • 455
  • 496
Kevin
  • 6,711
  • 16
  • 60
  • 107

5 Answers5

2

You need to add it to your build path. Right-click on the project in Project View, select Build Path->Configure Build Path, then Libraries tab. Now, use one of available options there to add a JAR.

Use "Add JAR" if you copied the jar to your project folder or "Add External JARs" to add it by poiting to a path in filesystem. (Anyway, it is better to copy the jar to the project folder, in which you want to use the jar).

HTH

pajton
  • 15,828
  • 8
  • 54
  • 65
1

see How to import class into existing Java project, with Eclipse

Community
  • 1
  • 1
Stefan De Boey
  • 2,344
  • 16
  • 14
1

Copy the google-api-translate-java-0.92.jar file to your project /WEB-INF/lib/ folder and refresh your project (right click on project and select "refresh").

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
0

Hy I have faced the same issue and fixed it

Step1: download google-translate-api jar file

step2: paste into your app library file

step3: Goto project structure > app > select dependencies -> then add path of your jar file...

Enjoy now you can acess google api services

0

Google Translate API v1 is deprectaed and will shutdown soon. You can use Google Translate API v2 Java. It has a core module that you can call from your Java code and also a command line interface module.

MosheElisha
  • 1,930
  • 2
  • 22
  • 27