Java learning overview)

Source: Internet
Author: User
Tags object serialization ibm developerworks
I. JDK (Java Development Kit)
JDK is the core of the entire Java, including the Java Runtime Environment (Java runtime envirnment), a bunch of Java tools and the Basic Java class library (RT. Jar ). No matter what Java application server is actually built into a certain version of JDK. Therefore, mastering JDK is the first step to learn java well. The most popular JDK is the JDK released by Sun. In addition to sun, many companies and organizations have developed their own JDK, such as JDK developed by IBM and jrocket of Bea, and JDK developed by GNU. Among them, the JVM (Java Virtual Machine) Running Efficiency of ibm jdk is much higher than that of Sun JDK. The jrocket running on the X86 platform is much more efficient on the server than Sun JDK. However, we still need to Master Sun JDK first.

1. Download and install JDK
JDK is also called j2se (Java2 SDK Standard Edition), can be downloaded from Sun's Java website, http://java.sun.com/j2se/downloads.html;, JDK current latest version is j2sdk1.4.2, it is recommended to download this version of JDK, download Page: http: // java.sun.com/j2se/1.4.2/download.html.

The downloaded JDK is an executable installation program. After the installation is completed by default, a set of JRE (for use by the browser) will be installed in the C:/program files/Java/directory. In C: /j2sdk1.4.2 install a set of JDK (including a set of JRE ). Then we need to add the Java path C:/j2sdk1.4.2/bin at the beginning of the Environment Variable path. In this way, JDK is installed.

2. JDK command tools
JDK's most important command line tool:
Java: Start JVM to execute class
Javac: Java compiler
Jar: Java packaging Tool
Javadoc: Java document Builder
These command lines must be very familiar with each parameter. JDK documentation provides detailed documents on how to learn these commands.

Ii. JDK documentation

Documentation is also available on the JDK download page. We recommend that you download documentation at the same time. Documentation is the most important programming manual, covering the description of all aspects of Java. It can be said that the majority of the time spent learning Java programming is spent reading this documentation. I carry it with me. When I write Java code, I can check it at any time.

3. app Server)

APP Server is a platform for running Java Enterprise components and forms the main runtime environment of application software. Currently, the mainstream app server is BEA's WebLogic Server, IBM's WebSphere, and free JBoss. You can select one of them for learning. I personally recommend WebLogic, because of its clean architecture and convenient development and deployment, it is the preferred development platform for Java Enterprise software developers. The following describes several common app servers:

1. Tomcat
Tomcat is not a real app server in a strict sense. It is just a Web container that supports running Serlvet/JSP. However, Tomcat also extends some app server functions, such as JNDI, database Connection Pool, user transaction processing, and so on. Tomcat is widely used in small and medium-sized Java Web applications. Therefore, this article introduces how to download, install, and configure Tomcat:

Tomcat is a subproject under the Jakarta project under the Apache organization, its main website is: http://jakarta.apache.org/tomcat/;, Tomcat latest version is tomcat4.1.27, software download connection is: http: // www.apache.org/dist/jakarta/tomcat-4/binaries /;.

To download tomcat, you can download both the zip package and the EXE installation package (I suggest you clean the ZIP file). In either case, after the download and installation are complete (you can decompress the ZIP file directly ). You need to set two environment variables:

Java_home = C:/j2sdk1.4.2
Catalina_home = D:/tomcat4 (your tomcat installation directory)

After installation, start Tomcat to run catalina_home/bin/startup. bat, and close tomcat to run the shutdown. Bat script. After Tomcat is started, port 8080 is used by default. Therefore, you can use a browser to access http: // localhost: 8080 to test whether Tomcat is started properly.

Tomcat provides two management tools on the web interface. The URLs are:
Http: // localhost: 8080/admin/index. jsp;
Http: // localhost: 8080/manager/html;
Before enabling these two management tools, you must manually configure the administrator user and password. Open the catalina_home/CONF/tomcat-users.xml file with a text tool and add the following lines:

<Role rolename = "manager"/>
<Role rolename = "admin"/>
<User Username = "Robbin" Password = "12345678" roles = "Admin, Manager, Tomcat"/>

In this way, the user "Robbin" has the super administrator permission. After you restart tomcat, you can use the user to log on to the two management tools above and configure and manage Tomcat on the web.

2. BEA WebLogic
WebLogic can download the latest Weblogic8.1 Enterprise Edition After free registration on the BEA website. License can be used for free for one year. In fact, this is enough. WebLogic download link: http://performance.bea.com/index.jsp, weblogic's on-line document: http:// edocs.bea.com /;.

3. IBM webshpere
WebSphere can also download to the free trial version, to IBM's developerworks website can see the download of Websphere trial products and related WebSphere information, the link of the Chinese site of developerworks is: http://www-900.ibm.com/developerWorks/cn/wsdd ;, webSphere download connection: http: // www7b.software.ibm.com/wsdd/downloads/wassupport.html ;.

4. JBoss
JBoss is a free and open-source app server. It can be downloaded from the JBoss website for free: Ghost. There are several good JBoss configuration documents on jdon for reference: http: // www.jdon.com/idea.html;

Iv. Java application Runtime Environment

Java applications can be divided into the following aspects:

1. Java Desktop applications
Desktop applications generally require only JRE support.

2. Java Web Applications
Java Web applications must install JDK, a Web Container (such as Tomcat), and a multi-user database. Web applications must be divided into at least three layers:
Browser layer: displays the user page in the browser.
Web layer: Run Servlet/jsp
DB layer: backend database that provides data access services to Java programs

3. Java Enterprise Applications
Enterprise applications are complex and can be extended to layer n. The simplest case is divided into four layers:
Browser layer: displays the user page in the browser.
Client layer: Java client graphics programs (or embedded device programs) directly interact with the web layer or EJB Layer
Web layer: Run Servlet/jsp
EJB layer: runs EJB to complete business logic operations
DB layer: backend database that provides data access services to Java programs

4. Java embedded applications
Java embedded applications are an emerging field. They are engaged in Embedded Development and need to download the j2's development kit from sun. j2's includes the dedicated virtual machine KVM for embedded devices, which is different from the JVM contained in the general JDK. You also need to download the simulator from a specific embedded vendor.

Java learning path (2), books

It is impossible to read only one or two books to learn a new knowledge. A step-by-step reading process is required. I recommend the Java series books published by oreilly.

Here I just want to add one point. Many people start with thinking in Java, but I think this book is not suitable for beginners. I think the correct way to use this book should be as an auxiliary reader. Thinking in Java is not a complete introduction to the entire java system, but a leaping writing method, it is a method similar to tips to deeply analyze and explain many Java knowledge points.

For beginners, it is best to find a book on getting started with Java, but it introduces Java syntax, object-oriented features, core class libraries, and so on in sequence. while reading this book, let's take a look at thinking in Java to deepen our understanding of Java and how it works. At the same time, we can fully understand the entire Java System.

For getting started books on Java, Cai xuexiao recommends oreilly's cutting ing Java, 2nd edition, or Java in a nutshell, 2nd edition (for C ++ background). I have not read these two books. In fact, I think the Electronic Industry Press's "Java 2 programming details" or "Java 2 from entry to mastery" is very good.

Among all the Java books, the most useful is not the Java serials of o'reilly. The most useful is the documentation of JDK! Almost all the knowledge you want to obtain is available in documentation. The most important part is the API documentation of the Java basic class library, which is organized by package, each class has a detailed explanation, its inheritance relationship, whether an interface is implemented, and where can all its public attributes and methods be found, the interpretation and meaning of each attribute, the purpose of each method, the called parameter, the meaning of the parameter, the type of the returned value, and the exceptions that the method may throw. In this way, all the books on Java programming are actually just in a relatively easy-to-understand language, and a good way to introduce the usage of some classes in a package in documentation. As a result, if you have enough ability to directly learn Java class libraries through documentation, you do not need to read other books. In addition, documentation is also a required manual for programming. There are three documentation shortcuts on my desktop: documentation of j2sdk1.4.1, documentation of servlet2.3, and documentation of j2sdkee1.3.1. With these three documentations, no other books are needed.

For Java Web programming, the core thing is to be familiar with and master the HTTP protocol, which has nothing to do with Java. After being familiar with the HTTP protocol, you need to be familiar with Java class libraries for implementing HTTP protocol, that is, Servlet APIs. The most important thing is servlet APIs. Of course, it is very difficult for beginners to learn web programming directly through servlet APIs. I recommend o'reilly's Java Server Pages book to learn web programming.

Among the EJB books, Enterprise JavaBeans, 2nd edition is a very good book. The learning threshold for EJB is relatively high and it is difficult to get started, however, this book completely reduces the difficulty of learning. It is particularly important that the learning of EJB should be combined with the specific implementation of an app server. Therefore, while learning EJB, you must learn an app server synchronously. This book has three related books: weblogic6.1, websphere4.0, and jboss3.0. There are both theories and practices. While learning EJB, you can view and do it while learning it, and learning EJB will become very easy.

However, this book also has a problem, that is, the old version mainly focuses on the ejb1.1 specification and some ejb2.0 specifications. The mastering EJB 2.0 book written by Ed Roman is completely written in accordance with ejb2.0 specifications. It covers all aspects of EJB programming and has a lot of programming experience tips, it is also one of the most recommended books for learning EJB.

If you use WebLogic to learn J2EE, the J2EE application and BEA WebLogic Server is definitely the first choice. Although it is about weblogic6.0, it is worth buying, this book is officially recommended by BEA, and the author is also an engineer of Bea. Now the Chinese version is everywhere. This book introduces the development and deployment of various J2EE technologies on the Weblogic Platform in combination with WebLogic, which has great practical guidance significance.

After having mastered the basic knowledge of the Java platform and the knowledge of J2EE, we should learn how to use the OO method to design the software, so we must learn the "Design Pattern ". Sun has published a J2EE Core Model, which is an essential book for architects who develop Java Enterprise platform software. This book comprehensively introduces various design modes of the J2EE architecture and is a must-read book for designers.

Java learning path (3) Process

Each person's learning method is different. One person's learning method is not necessarily suitable for another person. I can only talk about my learning method. Because I learned Java completely by myself and never asked anyone, the learning process was basically entirely self-developed. I don't know whether this method is a good one. I can only provide you with some reference.

The first step to learning Java is to install JDK and write a hello World ,? In fact, JDK learning is not that simple. There are two problems with JDK that are easily plagued by Java programmers: one is the classpath problem. In principle, it is necessary to understand how the JRE classloader loads the class, the package and import problems, and how to find the class path. By clarifying these two problems, we have removed the biggest obstacle to learning Java and using JDK. We recommend that you take a look at Wang Sen's "Java deep Adventure" and discuss these two issues in depth.

The second step is to learn the Java syntax. Java syntax is similar to C ++. Basically, the mainstream programming languages are not class C, but class C ++. There is no new things, so the syntax is learned, about half a day is enough. The only thing to note is that there are several keywords that are not easy to understand: public, protected, Private, static, when to use, why to use, and how to use, it may take a long time for someone to give me some advice. But later I saw thinking in Java, which mentioned these concepts.

The third step is to learn the features of Java's object-oriented programming language. For example, inheritance, constructor, abstract class, interface, method polymorphism, overload, overwrite, and Java exception handling mechanism. For a person without an object-oriented language background, I think this process takes a long time, because I have no C ++ experience before learning Java and only C experience, it took me about a month to fully understand these concepts. I tried to repeat, modify, and try the examples in the book and read them over and over again, after reading the past, I had to read it five times before I fully realized it. However, I think if I have C ++ experience, it may take a day or two. In this process, you can take a look at thinking in Java, which provides a thorough explanation of object-oriented. Unfortunately, I didn't see this book when I was studying it, so I spent a lot of time learning it through my own attempts and guesses.

Step 4: Get familiar with Java class libraries. The Java base library is the JRE/lib/RT. jar package under the JDK installation directory. Learning the basic library is to learn Rt. jar. There are many classes in the basic class library. It is said that there are more than 3000, and I have not made any statistics. But for us, there are only four at the core:
Java. Lang .*;
Java. Io .*;
Java. util .*;
Java. SQL .*;

The four packages of learning, each of which can be written as a thick teaching material, and o'reilly does. I think it is impossible to study by reading four books if the time is too short. I think the better way to learn is as follows:
First, read the entire package framework and understand the composition of the class, interface, and exception of the entire package. It is best to find an article about the entire package framework. The first few chapters of these books that specifically introduce the package should be the introduction of these general frameworks.

Understanding the overall framework of the package is not to be familiar with the usage of each class. Remember what attributes and methods it has. I cannot remember it. Instead, you need to know what types of packages constitute, what are the purposes of these classes, and what functions are completed by the core classes. During training, I usually talk about a package in a class, so it is impossible to describe the usage of each class in detail. However, I have repeatedly stressed that, what I want to tell you about these packages is not to tell you how class methods are called, nor to remember the class method calls, but to understand, java provides us with classes, where each class is used, and when I encounter a problem, I know which class or which combination of classes can solve my problem, that 'All !, When writing a program, you only need to know which class to use to complete your work. When coding, the specific method call is to write code while querying documentation. Everything is in documentation. You do not need to remember it, in fact, you cannot remember nearly 3000 method calls for more than 0.1 million classes. Therefore, it is extremely important to grasp the overall framework of each package.

Step 5: Through the above study, if the learning is solid, it will lay the foundation for Java, the rest of the work is to clear some useful classes except the above four packages in documentation. I believe that the progress has reached this step, and Java's self-learning capability has been developed. Now we can directly learn documentation. In addition to Gui programming, other useful packages in JDK are:
Java. Text .*;
Java.net .*;
Javax. Naming .*;
There are actually few classes in these packages, so it does not take a lot of time.

Step 6: Java Web Programming
The core of WEB programming is the HTTP protocol. The HTTP protocol has nothing to do with Java. If you are not familiar with the HTTP protocol, you can also learn Servlet/jsp programming well, but it cannot reach the same level. Therefore, learning the HTTP protocol is essential. If I am familiar with the HTTP protocol and have a good foundation for Java programming, it would be easy to learn Servlet/JSP. It took me less than a week to learn Servlet/JSP, then we started to use JSP for the project.

In Servlet/jsp learning, the beginning is still servlet documentation. The most common classes of servlet APIs are very few, so it takes a little time to master them. Read all these classes and write several more examples. The essence of Servlet/jsp programming is to call these classes repeatedly to communicate with the Web server and Brower over HTTP. In addition, for JSP, you also need to be familiar with several common JSP tags. If the specific writing method cannot be remembered, you can temporarily check the tags.

In addition, the focus of Java Web programming learning should be on the Design Pattern of Web applications. How to analyze the business logic and make rational design, in accordance with the requirements of the MVC design pattern, use Servlet and JSP to complete different logic layers, Master how to control the process and share data between Servlet and JSP, and how to configure and deploy Web applications.

Step 7: J2EE Programming
If the above learning process is relatively smooth, the difficulty increases sharply. Because the above knowledge only involves one aspect, and core J2EE specifications such as EJB, JMS, and JTA are often the result of the comprehensive application of several Java technologies, therefore, it is difficult to master.

First, you must learn the JNDI. The JNDI is the method used by the app server to locate server resources (EJB components, datasouce, JMS). If you are not familiar with JNDI, EJB, JMS is almost impossible to learn. JNDI is actually the javax. Naming. * package, which is easy to use. The difficulty lies in the configuration of server resource files. For the server resource file configuration, you need to look at the specific documentation specifications, such as web. xml writing, ejb-jar.xml writing and so on. You need to be familiar with each different app server and its own service resource configuration files.

Then we can learn about JTA, mainly to understand the JTA's method of controlling transactions, and where to use JTA. Here is a simple example. We know that transaction control (Conn. setautocommit (false ),...., conn. commit () is used as an atomic operation, but if my business needs to use operations on two different databases as an atomic operation, can you do it? At this time, only JTA can be used. Assume that the operation first inserts a record into database A and then deletes another record in database B. We cannot control the entire operation as an atomic operation by writing code on our own. If JTA is used, the app server controls it.

Before learning EJB, you need to learn Object serialization and RMI. Rmi is the foundation of EJB. Next, we will learn about JMS and ejbs. The most important thing for ejbs is to understand how ejbs call remote objects through RMI, and under what circumstances to use ejbs.

After learning about EJB and JMS, you may realize that you need to learn more about the two fields: UML and design pattern. Java Enterprise software design attaches great importance to Framework Design. A good software framework is a necessary condition for successful software development. At this time, we should begin to focus on the learning of the design mode and framework, and master the EJB Design Mode and the core mode of J2EE through learning and practical programming experience.

In the J2EE specification, there are many enterprise technologies in addition to EJB, JMS, JTA, Servlet/JSP, and JDBC, which are not described here.

There is also a new field of Web Services. Web Services does not have any new things at all. It is like a binder. Different services can be unified to provide a unified call interface. for users, I only need to obtain the WSDL (service description) provided by the service provider. I have no idea whether the service provided by the server provider is an EJB component or. I don't need to know about the net component, what is the CORBA component, or other implementations. The greatest part of web services lies in the sharing of Internet services by means of unified service provision and calling. It is a very exciting technical field. Web Services does not seem to have any good books yet, but you can learn it by checking information on the Internet.

Java learning path (4) Method

Java as a programming language, the best way to learn is to write code. After learning a class, you can write a simple example program to run it to see what the result is, and then call several more class methods to see the running result, in this way, the class is learned intuitively and the memory is very deep. The code should not be called. You should think about it. If I don't write it like this, try again. I remember which expert said that learning programming is a process of destruction. After running the examples in the book and learning the examples compiled by documentation, he constantly tries to implement them in different ways, constantly try to break the code structure and see what results it will have. In this way, you will have a thorough understanding of Java.

For example, we have compiled Hello world.

Public class helloworld {
Public static void main (string [] ARGs ){
System. Out. println ("Hello World ");
}
}

Many beginners do not quite understand why the main method must be defined as public static void main (string [] ARGs) in this way. Can it be written like this? This includes questions when I first learned Java. Do you want to know the answer? It is very simple. You should change the main name to run it to see what errors are reported and analyze them based on the error information. Remove the public of main and try again to see what errors are reported; static removal can still be run; do not know if the main method must pass a string [] array, change string [] to int [], or try it out; if you do not know whether to write the ARGs parameter name, you can also change the ARGs to another name to see how the running result works.

This is what I did when I first studied java. I modified the hello World Program seven or eight times and kept running and analyzed the running results, finally, I fully understand why the main method is defined in this way.

In addition, I didn't understand Staic, public, private, exception, try {} catch {} finally {} and so on at the beginning. They all succeeded in running the example above the reference books, then, I began to destroy it and constantly rewrite the program based on my questions to see if it could run, what it was like to run, and whether it could get the expected results. This is time-consuming, but an example program is destroyed several times in this way. I have completely learned the relevant knowledge. Sometimes you may even intentionally write some wrong code to run it and see if you can get the expected running error. In this way, we have a profound understanding of programming.

Among them, it is particularly worth mentioning that JDK has a very good debugging function,-verbose
Java? Cverbose
Javac? Cverbose and many other JDK tools have this option.
-Verbose can display the classes loaded by the JVM in sequence during command execution. Through these valuable debugging information, this helps us analyze what the JVM has done during execution.

In addition, many of the destructive routines you write during the learning process should be consciously stored in different categories, and the typical routines accumulated in your work should also be sorted regularly, you have a code library. If you encounter similar problems, just copy & paste, search & replace in the code library, which greatly improves the development speed. The ideal situation is to abstract some common routines to form a common class library and encapsulate them. The reusability is enhanced.

So I don't think it is really a special routine. The destroy routine you write is the best example. If you are not at ease with the code you write, I strongly recommend that you check the Java source code of the JDK base class library. There will be a src.zip under the JDK installation directory, and you can see the entire JDK base class library, that is, Rt. jar Java source code. You can refer to how sun writes Java programs and what the specifications look like. When I am learning Java class libraries, when I do not understand them clearly or want to understand the operation details more clearly, usually open the source code of the corresponding class. by looking at the source code, all problems will be swept away.

Java learning path (5) Resources

1. http://java.sun.com)
Sun's Java website should be visited frequently. Needless to say.

2. http://www-900.ibm.com/developerWorks/cn;
For the IBM developerworks website, go to the English site. This is not only an excellent Object-Oriented Analysis and Design website, but also an excellent website for Web Services, Java, and Linux. It is strongly recommended !!!

3, http://www.java-cn.com/; (Chinese)
Java Chinese site. Currently, Java technology websites with the most comprehensive materials and members in China are very popular. Java e-book library and Java Video Library (the only one in China) main topics such as Java technical digest library, Java source code library, Java tool library, and recruitment and job search square. There are also some expert topics. Currently, there are more than 50 thousand VIP members and nearly 1000 VIP members. You can find what you need on cainiao or laruence's website !! It is strongly recommended !!!!!!

4. http://www.javaworld.com)
Discussions and news about many new Java technologies. I 'd like to know more about all aspects of Java, which is better here.

5. http://dev2dev.bea.com.cn/index.jsp;
Bea's developer field, Bea, as the most important app server vendor, has many unique technologies that can be missed by partners who develop on weblogic.

6. http://www.huihoo.com /;
The gray fox power website, a professional middleware website, is not a professional Java website, but has profound accomplishments in J2EE enterprise application technology.

7. http://www.theserverside.com/home)
Theserverside is a famous website dedicated to Java server applications.

8. http://www.javaresearch.org /;
The Java research organization has many excellent articles and tutorials on Java, especially in JDO.

9. http://www.cnjsp.org /;
JSP technology websites have a considerable number of Java articles and resources.

10, http://www.jdon.com /;
Jdon forum is a personalized Chinese J2EE Professional Technology Forum. Among the many Java Chinese forums, jdon is a forum with high technical content and excellent post quality.

11. http://sourceforge.net /;
Sourgeforge is the base camp of open source software, which also has a very rich set of Java open source famous software.

 

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.