Using the Java API Action hdfs--read the HDFs file and print

Source: Internet
Author: User

Create the class file in MyClass, this MyClass directory is created by itself.

The following error is reported when compiling:

It's obvious that the result of not importing the package

See this API website, you can find the response package, and of course the Java API documentation

Http://hadoop.apache.org/docs/r1.2.1/api/index.html

http://docs.oracle.com/javase/7/docs/api/

By looking for two documents, you need to import

The following package:

However, the error will still be reported as follows:

That's because he couldn't get the files that need to be imported specifically where, through the Search API documentation, it is known that its Hadoop-related classes, tease the presence of the core jar package inside

So there are the following commands:

Look, this compiles successfully.

And then in the run

In this way, you can run the operation successfully, because the classpath is set, so even in other directories can find Urlcat this class.

Where Hadoop's jar packages exist

Using the Java API Action hdfs--read the HDFs file and print

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.