Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to package the project and the third-party jar package into a whole ar package after modifying the nutch source code

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to modify the nutch source code to make the project and the third-party jar package into an overall ar package. I hope you will get something after reading this article. Let's discuss it together.

After I packed the jar package, I ran it under Linux.

[root@nutch-five test] # java-jar crawl-test.jar

The error message is:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/util/Tool

Our third-party jar package didn't work.

At first, I always thought that the method of packing was wrong. Tossing and turning for hours. In the end, the boss came up with another idea. He thought it might be easier to package it with ant. However, after looking for some information on the Internet, I found it very troublesome. In the end, this method was not done.

Continue to check for errors, I also wondered if it was the problem with the hadoop jar package. I think it might be that the content program could not be found under the META-INF file under hadoop-core.jar. In fact, this is not the reason, the above ideas are just guesses. The structure of hadoop-core.jar is exactly the same as that of other third-party jar packages.

I can't help it. Finally, I don't know how to get a brain shot. Then I figured out why I didn't test it in the dos under windows. This time, it is found that the jar package can be run.

When I got here, the boss asked me, why not under Linux, but not under Windows? In fact, when I was happy at that time, I never thought about this question: why the jar package can run successfully under windows, but not under Linux.

The boss mentioned the idea, and he said, "could it be a matter of path?" Because the path separator under windows is different from that under Linux. I suddenly ~ ~ this kind of possibility is very big!

I am always confused about a series of differences between windows and Linux, such as paths, escape characters, and so on. Although I know they are different, I can't remember them every time. As a result, every time we encounter these problems, we will waste a lot of time doing useless work.

The feeling this time is:

1. Persevere. Sometimes hope appears when you are so desperate that you are about to give up.

2. Think actively and don't confine yourself to a very small frame. It's best to think in the sky. Sometimes, two seemingly unrelated things can solve your problems when you look at them in a different way.

3. Keep looking back. Review your previous thoughts, review your previous practices, and see what key points you missed. Sometimes the train of thought and direction are not wrong, the fault lies in the details. But I still think that maybe the train of thought and direction are too far away.

4. When you encounter a problem, you can't just solve the problem, but also know why. Figure it out and pay attention to it next time.

Combined with the relevant information of the predecessors:

Multi-project interdependent Java programs are packaged and external Jar packages are introduced two ways for Eclipse to package Java projects that reference third-party jar packages into jar files

Simple jar packaging example merges third-party jar package packaging operations

The detailed packaging process is listed below:

1. Create a new folder META-INF under the project we need to package. My project name is nutch source code project name branch-1.7

2. Create a new file MANIFEST.MF under META-INF. The contents of the file are similar:

Manifest-Version: 1.0Main-Class: com.pacong.convert.auto.propertes.ConvertAutoProperties Class-Path: lib/xxx.jar lib/yyy.jar lib/zzz.jar after reading this article, I believe you have a certain understanding of "how to modify the nutch source code to package the project and the third-party jar package into a whole ar package". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report