Questions Guide:
1. website src package Download, can I use it directly?
2. How do I track and view Hadoop source code?
This article is from zero teaches you how to obtain hadoop2.4 source code and use eclipse associated hadoop2.4 source on the basis of a continuation, the above has actually downloaded the source. After the download, how do we view the source code.
We're still using Eclipse's import function, here's a brief description of the 0 basics of how you can import Java projects into eclipse.
1. Import to view Hadoop source code
(1) Select existing Projects into Workspace
<ignore_js_op>
(2) Select the source path
<ignore_js_op>
(3) View source code
<ignore_js_op>
So we're done with all the content.
2. Read the Hadoop source code
One of the more commonly used
Open Call Hierarchy:
Use the open call hierarchy to view the calling hierarchy of the method. If you want to know where a method is called in other places, this function is very useful, in fact, it is also very common, such as to reconstruct a method, want to know what other places he may have influence, you can use this function. Right-click on the method name, select Open Type hierarchy, shortcut key is ctrl+alt+h. You can see the navigation of the method's call hierarchy in the Calls Hierarchy window.
Open Type Hierarchy:
With the open type hierarchy you can see the inheritance relationship of the class, and you can see the inheritance level navigation in the Hierarchy window. Right-click on the method or class name, select Open Type hierarchy, shortcut key is F4.
Here's a demonstration:
<ignore_js_op>
See the following code
<ignore_js_op>
Introduction, here are some other ways to track the source code:
1. Use open declaration to view declarations of classes, methods, and variables. This is the most commonly used feature, if you want to track the object on the right-click, select Open Declaration, you can jump to its declaration of the place. This function has a shortcut key is F3, of course you can also hold down the CTRL key, the mouse moves over will become a small hand, click on it.
2, with open Super Implemention can see the current method in the parent class implementation or the interface declaration (if the method is a parent class or interface overrides), right-click on the method name, select Open Super implemention.
3, finally introduced a super easy to use function, called open implemention, is can jump to a call method of the specific implementation of the place to go. Why do you think this is super useful? People who have used spring know that they are now advocating interface-oriented programming, so if you use open declaration to track the invocation of a method, you will only see the method's declaration in the interface, but not the implementation of the method in the specific class, and of course, you can use the call Hierarchy first get the entire call level of the method, and then navigate to the specific implementation, but the operation is a bit cumbersome. With the open implemention, you can directly see the implementation of the Code, in the method name right click, choose Open implemention on it! Just to enjoy this feature, you can install an Eclipse plugin, which is not described in detail here.
How to view and read hadoop2.4 source code through eclipse