The code is very simple, just open a picture.
But when I run this I have an error like this:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.imgcodecs.Imgcodecs.imread_1(Ljava/lang/String;)J
at org.opencv.imgcodecs.Imgcodecs.imread_1(Native Method)
at org.opencv.imgcodecs.Imgcodecs.imread(Imgcodecs.java:112)
According to the searched solution, I add this System.load(Core.NATIVE_LIBRARY_NAME) to the main(), doesn't work:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: opencv_java401
at java.lang.Runtime.load0(Runtime.java:806)
at java.lang.System.load(System.java:1086)
Or this System.loadLibrary(Core.NATIVE_LIBRARY_NAME), still not work:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java401 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
My project is build by gradle, the dependencies is (official doc):
compile group: 'org.bytedeco', name: 'javacv-platform', version: '1.5'
Thank you for your help.
Self answer.
My import is wrong. It should be
import static org.bytedeco.opencv.global.opencv_imgcodecs.imread
instead of
import static org.opencv.imgcodecs.Imgcodecs.imread
This error caused the wrong package to be used.
The correct code is:
import org.bytedeco.opencv.opencv_core.Mat;
import static org.bytedeco.opencv.global.opencv_imgcodecs.imread;
public class DemoApplication {
public static void main(String[] args) {
Mat image = imread("/root/test.png");
System.out.println("width:" + image.cols());
System.out.println("height:" + image.rows());
}
}
Related
TestNG Error in Maven ProjectHi Davis and others as well: - Below is my project screenshot and code and i am getting this TestNg Error using Maven Project, please help me on this and I have also attached few screenshots for reference:-
GenerateReports.java
package ExtentReports.GenerateHTMLReports;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentSparkReporter;
public class GenerateReports {
ExtentReports E2;
#BeforeTest
public void config()
{
String s1 = System.getProperty("user.dir")+"\\reports\\index1.html";
ExtentSparkReporter E1 = new ExtentSparkReporter(s1);
E1.config().setReportName("MyAutomationReport");
E1.config().setDocumentTitle("GoogleHomePage");
E2 = new ExtentReports();
E2.attachReporter(E1);
E2.setSystemInfo("Tester", "G");
}
#Test
public void initializeDriver()
{
E2.createTest("MyHTMlReportTest");
System.setProperty("webdriver.chrome.driver",
"F:\\Selenium_Training\\Ganesh_Project\\Browser_Drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
driver.getTitle();
driver.close();
E2.flush();
}
}
Pom.xml
I am getting a TestNG error while running a Maven project in XML and here is the error message:-
org.testng.TestNGException:
TestNG by default disables loading DTD from unsecured Urls. If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true]
at org.testng.xml.TestNGContentHandler.resolveEntity(TestNGContentHandler.java:115)
at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEn
Also, i tried the below possibilities and again getting error message which is different from this:-
I tried to add Jvm argument -Dtestng.dtd.http=true and placed it under run -->run configurations-->arguments-->VM arguments in eclipse
After placing the above jvm argument i am getting this new error message in console, do not know how to solve it below is the error after adding jvm argument and running the maven project:-
org.testng.TestNGException: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at org.testng.TestNG.parseSuite(TestNG.java:354)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:374)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:103)
SDK Version : 29
dji SDK Version : 4.12
implementation 'com.dji:dji-sdk:4.12', {
exclude module: 'library-anti-distortion'
exclude module: 'fly-safe-database'
}
compileOnly 'com.dji:dji-sdk-provided:4.12'
And I get that error :
AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.i_ron, PID: 15818
java.lang.NoClassDefFoundError: Failed resolution of: Ldji/sdk/sdkmanager/BluetoothProductConnector;
please help me I need to be hurry for this project.
The error suggests that you have not called com.secneo.sdk.Helper.install(context).
This is usually done in an override of Application class. You also need to indicate the new application class override in the manifest.
Look at the sample app:
<application
android:name=".internal.controller.DJISampleApplication"
and in the Application override:
public class DJISampleApplication extends MultiDexApplication {
protected void attachBaseContext(Context paramContext) {
super.attachBaseContext(paramContext);
MultiDex.install(this);
com.secneo.sdk.Helper.install(this);
app = this;
}
I want to record video quiet and without preview in Android. So I choice MediaRecorder but I could record only without preview but what make me crazy is that when MediaRecorder start or stop it will with a sound dee.... I try many methods about that . But I think it perhaps sth related to the OS of the mobile. So I try JavaCV because I also want to have a Live function in my app.
But JavaCV spent me to too much time to solve some strange problems because it's my first time to do sth about C++ src and video.
Just compile group: 'org.bytedeco', name: 'javacv-platform', version: '1.3' as the README.md ,I even can't build my apk.
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/bytedeco/javacpp/macosx-x86_64/libusb-1.0.dylib
File1: /Users/wyx/.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/libfreenect/0.5.3-1.3/736d65a3ef042258429d8e7742128c411806b432/libfreenect-0.5.3-1.3-macosx-x86_64.jar
File2: /Users/wyx/.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/libdc1394/2.2.4-1.3/f1498dacc46162ab68faeb8d66cf02b96fe41c61/libdc1394-2.2.4-1.3-macosx-x86_64.jar
And then I modified it according this issuse
use this to repalce. It can build the apk. But the can't run.
android {
..............
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
}
}
dependencies {
compile group: 'org.bytedeco', name: 'javacv', version: '1.3'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-x86'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.1.0-1.3', classifier: 'android-x86'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.1.0-1.3', classifier: 'android-arm'
}
My demo code VideoService which will invoke in MainActivity
package com.fs.fs.api;
import com.fs.fs.App;
import com.fs.fs.utils.DateUtils;
import com.fs.fs.utils.FileUtils;
import org.bytedeco.javacpp.avcodec;
import org.bytedeco.javacv.FFmpegFrameRecorder;
import org.bytedeco.javacv.FrameRecorder;
import java.util.Date;
/**
* Created by wyx on 2017/1/11.
*/
public class VideoService {
private FFmpegFrameRecorder mFrameRecorder;
private String path;
private VideoService() {
}
private static class SingletonHolder {
private static final VideoService INSTANCE = new VideoService();
}
public static VideoService getInstance() {
return SingletonHolder.INSTANCE;
}
public void startRecordVideo() {
String fileName = String.format("%s.%s", DateUtils.date2String(new Date(), "yyyyMMdd_HHmmss"), "mp4");
path = FileUtils.getExternalFullPath(App.getInstance(), fileName);
mFrameRecorder = new FFmpegFrameRecorder(path, 640, 480, 1);
mFrameRecorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
mFrameRecorder.setVideoOption("tune", "zerolatency");
mFrameRecorder.setVideoOption("preset", "ultrafast");
mFrameRecorder.setVideoOption("crf", "28");
mFrameRecorder.setVideoBitrate(300 * 1000);
mFrameRecorder.setFormat("mp4");
mFrameRecorder.setFrameRate(30);
mFrameRecorder.setAudioOption("crf", "0");
mFrameRecorder.setSampleRate(48 * 1000);
mFrameRecorder.setAudioBitrate(960 * 1000);
mFrameRecorder.setAudioCodec(avcodec.AV_CODEC_ID_AAC);
try {
mFrameRecorder.start();
} catch (FrameRecorder.Exception e) {
e.printStackTrace();
}
}
public void stop() {
if (mFrameRecorder != null) {
try {
mFrameRecorder.stop();
mFrameRecorder.release();
} catch (FrameRecorder.Exception e) {
e.printStackTrace();
}
mFrameRecorder = null;
}
}
}
MainActivity
package com.fs.fs.activity;
import android.app.Activity;
import android.os.Bundle;
import com.fs.fs.R;
import com.fs.fs.api.VideoService;
import static java.lang.Thread.sleep;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoService.getInstance().startRecordVideo();
try {
sleep(10 * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
VideoService.getInstance().stop();
}
}
Error which make me want to cry.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.fs.fs, PID: 30259
java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
at org.bytedeco.javacpp.Loader.load(Loader.java:590)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
at com.fs.fs.api.VideoService.startRecordVideo(VideoService.java:34)
at com.fs.fs.activity.MainActivity.onCreate(MainActivity.java:75)
at android.app.Activity.performCreate(Activity.java:5304)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2331)
at android.app.ActivityThread.access$1000(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5291)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at org.bytedeco.javacpp.Loader.load(Loader.java:585)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
at com.fs.fs.api.VideoService.startRecordVideo(VideoService.java:34)
at com.fs.fs.activity.MainActivity.onCreate(MainActivity.java:75)
at android.app.Activity.performCreate(Activity.java:5304)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2331)
at android.app.ActivityThread.access$1000(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5291)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org/bytedeco/javacpp/avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at org.bytedeco.javacpp.Loader.load(Loader.java:585)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
at com.fs.fs.api.VideoService.startRecordVideo(VideoService.java:34)
at com.fs.fs.activity.MainActivity.onCreate(MainActivity.java:75)
at android.app.Activity.performCreate(Activity.java:5304)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2331)
at android.app.ActivityThread.access$1000(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5291)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.bytedeco.javacpp.avutil" on path: DexPathList[[zip file "/data/app/com.fs.fs-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.fs.fs-2, /vendor/lib, /system/lib, /data/datalib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at org.bytedeco.javacpp.Loader.load(Loader.java:585)
at org.bytedeco.javacpp.Loader.load(Loader.java:530)
at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1694)
at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
at com.fs.fs.api.VideoService.startRecordVideo(VideoService.java:34)
at com.fs.fs.activity.MainActivity.onCreate(MainActivity.java:75)
at android.app.Activity.performCreate(Activity.java:5304)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2331)
at android.app.ActivityThread.access$1000(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5291)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
So I want to know a comfortable method to achieve my goal : recode video quiet and without preview. And Live real time ?
I found ffmpeg4android is a prefect library to run ffmpeg command. I just use it to compress videos from MediaRecorder But I don't how to do use it to achieve my goal.
I'm just wondering why I cannot load a resource with the Thread context loader in Felix OSGi? Am I not supposed to touch the context loader, am I doing something wrong or is it a bug?
I've a super simple bundle with a simple Activator:
public class Activator implements BundleActivator {
public void start(BundleContext context) throws Exception {
System.out.println("Hello World!!");
String resourcePath = "META-INF/mySuperDuperResource.txt";
// works
System.out.println(Activator.class.getClassLoader().getResource(resourcePath));
// null-pointer exception
System.out.println(Thread.currentThread().getContextClassLoader().getResource(resourcePath));
}
public void stop(BundleContext context) throws Exception {
System.out.println("Goodbye World!!");
}
}
Now loading the resource with with the class loader with the Activator.class.getClassLoader works. But not with the Thread.currentThread().getContextClassLoader(). There I get:
ERROR: Bundle info.gamlor.osgi [26] Unable to get module class path. (java.lang.NullPointerException)
java.lang.NullPointerException
at org.apache.felix.framework.BundleRevisionImpl.calculateContentPath(BundleRevisionImpl.java:410)
at org.apache.felix.framework.BundleRevisionImpl.initializeContentPath(BundleRevisionImpl.java:347)
at org.apache.felix.framework.BundleRevisionImpl.getContentPath(BundleRevisionImpl.java:333)
at org.apache.felix.framework.BundleRevisionImpl.getResourceLocal(BundleRevisionImpl.java:472)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)
at org.apache.felix.framework.BundleWiringImpl.getResourceByDelegation(BundleWiringImpl.java:1360)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.getResource(BundleWiringImpl.java:2256)
at info.gamlor.osgi.Activator.start(Activator.java:23)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:641)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1977)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)
...
org.osgi.framework.BundleException: Activator start error in bundle info.gamlor.osgi [29].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2027)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)
at org.apache.felix.gogo.command.Basic.start(Basic.java:729)
...
Caused by: java.lang.NullPointerException
at org.apache.felix.framework.BundleRevisionImpl.getResourceLocal(BundleRevisionImpl.java:474)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)
at org.apache.felix.framework.BundleWiringImpl.getResourceByDelegation(BundleWiringImpl.java:1360)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.getResource(BundleWiringImpl.java:2256)
at info.gamlor.osgi.Activator.start(Activator.java:23)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:641)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1977)
... 32 more
Now when just set the thread context class loader it works just fine:
Thread.currentThread().setContextClassLoader(Activator.class.getClassLoader());
But that has a hacky feeling to it. Feels like that will bite me later.
I'm not sure why your surprised this happens. A thread's context classloader is, by default, set to the classloader of it's parent, which in the beginning is set to the system classloader. So, assuming you don't do anything special, the context classloader is the system classloader, which is not the same as your bundle's classloader, hence it can't find your resource.
I agree that setting the context classloader has a hacky feel to it, but some libraries require this. I would do something like,
ClassLoader previous = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
badlyBehavedLibraryCall();
Thread.currentThread().setContextClassLoader(previous);
I have a created a simple MapReduce Driver that implements the Tool interface. But when I try to run the job in Eclipse, I get a NoClassDefFoundError before the run() method is invoked.
I am running Hadoop 0.20.2 on Ubuntu 10.04 LTS. The source code and stack trace are provided below. Any assistance will be greatly appreciated.
Sourcecode
import org.apache.hadoop.conf.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.*;
public class MyTestDriver extends Configured implements Tool {
#Override
public int run(String[] args) throws Exception {
if (args.length != 2) {
System.err.printf("Usage: %s [generic options] <input> <output>\n",
getClass().getSimpleName());
ToolRunner.printGenericCommandUsage(System.err);
return -1;
}
// Code here to submit Hadoop Job ...
return 0;
}
/**
* #param args
*/
public static void main(String[] args) throws Exception {
int exitCode = ToolRunner.run(new MyTestDriver(), args);
System.exit(exitCode);
}
}
Stacktrace
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/cli/ParseException at
org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:59) at
org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79) at
MaxTemperatureDriver.main(MaxTemperatureDriver.java:44) Caused by:
java.lang.ClassNotFoundException:
org.apache.commons.cli.ParseException at
java.net.URLClassLoader$1.run(URLClassLoader.java:202) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:190) at
java.lang.ClassLoader.loadClass(ClassLoader.java:307) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 3 more
Are all of Hadoop's dependencies in your Eclipse build path? Make sure all the jars in the hadoop/lib directory are in your build path.
The error means that there was a particular class that was not found. Classes are stored within .jar files. So, you need to check if all the required jar files are available or not. Jar files are searched based on the CLASSPATH variable. If you are using Eclipse as your development environment, please check if the build dependencies are satisfied (you can do this by - right clicking on your project -> configure build path -> add external jar).
Also, if you are not sure which class is missing, you can check the classname (Hadoop is open source, so you can find the class name) and then search the class name in findjar