How would I import a library to a java selenium project? - java

I would like to use the java library Faker, which generates fake data.
http://dius.github.io/java-faker/
Since I can't import it, how can I add the files from the zip into my project.
This is my current project structure
Project
src
default package
FirstProgram.java
JRE System Library
Referenced Libraries
Any help is greatly appreciated!!

Extract the Zip.
Right Click on Referenced Library -> Build Path-> Configure Build Path
Import the extracted zip in your library

Related

Import library into eclipse non gradle project

I am very new to Android development. I am not using gradle. I want to use the following library
Can you please let me know how to include in my project.
When I clone your project to eclipse(Mars) it is showing the following structure-
My project structure is given below.
Now shall I copy the "lib" folder (lib\src\main...) to my "src" folder?
Normally I add the library like the following way-
Just import the lib folder of the library instead of the whole library in Eclipse. And add it as a library to your project.

eclipse import project from tomcat webapp

i have a project in tomcat,and use startup to set up it.
i want to import it into eclipse in order to debug it,and then i try to import project like this:
it displays no project found, maybe it does not have .project file
how could i import it correctly and conviently? there are only class in web-inf,so how could copy it?
Do the following:
Create new Dymanic Web Project in Eclipse
Right click -> Import -> General -> File system, on this project.
Choose source directory.
And check Java Build Path in your project to be sure your Libraries correctly loaded.
There is no direct way to do this, however...
Perhaps, the simplest way to do this is the following:
Download Eclipse Java EE
Create a Dynamic Web project
Copy the contents of your webapp (or war) to the WebContent folder
If the project contains Java sources andyou have access to them add them (including the package structure) to the src folder.

Importing JParsec in Eclipse

I downloaded both the .jar file and the "source and documentation" zip archive from the JParsec download section. Somehow I failed to import the JParsec source code using the Eclipse IDE (and also to find any documentation). Can someone please explain how to import it?
Thanks a lot!
You need to create a Java project and add the appropriate .jar file into the build path. You can also link the source file to the .jar file using the "Build Path" choice.
The codehaus project is no longer active, jparsec is now hosted on github. If you clone the source code from there, you can import the project using the maven plugin for Eclipse, or alternatively do mvm eclipse:eclipse inside the project source tree and then open the project in Eclipse.

How to include oauth library in Eclipse?

I found some OAuth library for Java: http://code.google.com/p/oauth/. But how am I supposed to include this library in Eclipse for usage? I've got last classic version of Eclipse. I'm a newbie.
Just want to be able to import i.e. all of those:
import net.oauth.client.httpclient4.HttpClient4;
import net.oauth.client.OAuthClient;
import net.oauth.OAuthServiceProvider;
import net.oauth.OAuthConsumer;
import net.oauth.OAuthAccessor;
import net.oauth.OAuth;
import net.oauth.OAuthMessage;
import net.oauth.OAuthException;
as in example http://oauth.googlecode.com/svn/code/java/example/command-line/src/net/oauth/example/cmdline/OAuthHelper.java
In Eclipse right click on the project you would like to include the library in and click properties.
Click on Java Build Path and then on the Libraries tab.
Click Add External Jar... and navigate to the library you downloaded.
You can now use this in your project!
In a separate project keep all the source files.
Export jar of the project.
Creating a New JAR File
Right click on the project you would like to include the jar created and click properties.
Click on Java Build Path and then on the Libraries tab.
Click Add External Jar and select the jar created.

Questions on how to import google-api-translate-java.jar

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?
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
see How to import class into existing Java project, with Eclipse
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").
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.
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

Categories