org.apache.hadoop.mapreduce Not Found-- Hadoop - java

I am working on Hadoop. I need to process images using the power of Big Data. To play around with it, I have referred this example.
I need to create Sequence file prior working on the image duplicates.
So i used this source code for creating sequence file.
When i compile this in Hadoop environment i am missing some packages. I am using Hadoop-0.18.0.
/tmp/BinaryFilesToHadoopSequenceFile.java:12: package org.apache.hadoop.mapreduce does not exist
import org.apache.hadoop.mapreduce.Job;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:13: package org.apache.hadoop.mapreduce does not exist
import org.apache.hadoop.mapreduce.Mapper;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:14: package org.apache.hadoop.mapreduce.lib.input does not exist
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:15: package org.apache.hadoop.mapreduce.lib.input does not exist
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:16: package org.apache.hadoop.mapreduce.lib.output does not exist
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
^
/tmp/BinaryFilesToHadoopSequenceFile.java:17: package org.apache.hadoop.mapreduce.lib.output does not exist
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
Whether am i doing anything wrong?? Or is it not available in 0.18.0.
I know this version is very old version. Due to some restrictions i am using an already configured VM to work with ,which is having this version of hadoop.
Any Help would be appreciated!!

I can't easily find a copy of 0.18.0 to download anymore, but it looks like the mapreduce package was not available in this version (or 0.19):
http://www.java2s.com/Code/Jar/h/Downloadhadoop0180corejar.htm
http://www.java2s.com/Code/Jar/h/Downloadhadoop0190corejar.htm
It's definately in 0.20.2 though

try using 0.20.X hadoop core package version to make use of org.apache.hadoop.mapreduce.* classes

Related

how to import joda time in java on Ubuntu system

I'd like to generate dates sequence in a range. This thread suggests to use Joda-Time package. I downloaded it and unzipped it to the same directory as my Main.java.
When I try import ./joda-time-2.7/org.joda.time.DateTime;, the compiler says:
Main.java:4: error: expected
import ./joda-time-2.7/org.joda.time.DateTime;
^
Main.java:4: error: expected
import ./joda-time-2.7/org.joda.time.DateTime;
^
Main.java:4: error: class, interface, or enum expected
import ./joda-time-2.7/org.joda.time.DateTime;
^
And when I try import org.joda.time.DateTime;, the compiler says:
MissingDateSearch.java:5: error: package org.joda.time does not exist
import org.joda.time.DateTime;
^
It seems that I didn't include the package into my building path. This thread discusses how to set the building path for java. Currently, my "environment" file only has PATH variable. I don't want to make any global change just for one project.
So my question is, does any one know how to include the package in a way without global change? Or does any one has a simple way to generate dates in a range without joda-time?
Thanks!
ADDED
This problem can be bypassed by using IDEs like eclipse. Any terminal based solutions are still welcomed.
Use the
import org.joda.time.DateTime;
import statement and ensure that JodaTime jar file is on your classpath at compile & runtime

I added the javax.mail, but it keeps saying the class does not exist

Here's the thing: I've downloaded the javax.mail API, added it under Libraries->Add Jar/Folder. I've compiled the code, but it keeps yielding an error on the 'import javax.mail;' sentence, saying that the package does not exist. What is going wrong?
You've mentioned this line:
import javax.mail;
This won't work, because mail is a package and not a class. Either use:
import javax.mail.*;
to import the whole package or import specific classes using:
import javax.mail.Header;
import javax.mail.Message;
import javax.mail.Session;
(the classes are randomly selected and should only show how to import a specific class)
you commented
I've extracted the javax.mail JAR file to the netbeans8.0.2 folder
you dont need to do that,
it should be enough to put the jar in your project's lib folder and maybe reference it in the build path.
cheers

How to import my java class into another java class in Xpages java

In my Xpage, I have added to Java classes. One is "AUser" declared in Models package and one is "AUserRepository" declared in a Repository package.
When I try and import AUser into a class in my AUserRepository... the import statement I type in is not working.
import com.Discussion.utils.AUser;
Weird thing is, If I exit out of Notes and load up eclipse standalone, and make the same kind of stuff, the import works fine. Am I missing out some important factor in Xpages?
The problem definitely is the import routing.
import Models.AUser;
import Repository.AUserRepository;
Is the project build path correct? Project - Properties - Java build path. Also, have you tried cleaning the project? Project - Clean....

Importing javax package in Java without an IDE

I'm developing a project in Java using Vim, and I need to use some classes from the javax package. What should I install and configure to be able to import any of them?
I already installed the JDK 7 and also put it as my default using update-alternative command.
For example, when I compile a class (for example one called GUI) that uses the javax package, the compiler displays:
> javac GUI.java
GUI.java:1: error: package javax does not exists
import javax.swing;
^
1 error
I think it is related to the $CLASSPATH environment variable, but I'm not sure how to tell the compiler where the package is (since it is inside the JDK 7).
Instead of trying to import javax.swing, which does not actually specify anything specific, you should import javax.swing.*. This imports everything in the javax.swing package.
import javax.swing.*;
You can also import specific swing components and utilities:
import javax.swing.JButton;
See The Java Tutorials page on Using Package Members for more information about importing package members.
You should be importing as:
import javax.swing.*;
or else for example
import javax.swing.JFrame;

import chat.server not found

When I develop an RMI server, I use:
import java.rmi.server.UnicastRemoteServer;
import java.rmi.server.StubSecurityManager;
import chat.server.*;
But when I compile the Java file, an error occurs that says:
Class java.rmi.server.UnicastRemoteServer not found in import. import
java.rmi.server.UnicastRemoteServer
and also error with StubSecurityManager. Please help me work out this problem.
It appears that you are using an old code written in JDK1.1 trying to compile using newer version of JDK.
You need to make following changes.
java.rmi.server.UnicastRemoteServer -> java.rmi.server.UnicastRemoteObject
java.rmi.server.StubSecurityManager -> java.rmi.RMISecurityManager
Source:
http://groups.google.com/group/comp.lang.java.api/browse_thread/thread/c768d6617f80eedd/4edf4acebd2ce575

Categories