Java Learning Route

Source: Internet
Author: User
Tags object serialization jboss

Getting Started with Java to master
transferred from: http://forum.hibernate.org.cn
Author: Robbin
Java Learning Path (i), tools
First, JDK (Java development Kit)

The JDK is the core of the entire Java, including the Java Runtime (Java Runtime Envirnment), a stack of Java tools, and a Java-based class library (Rt.jar). Any Java application server is essentially a built-in version of the JDK. So mastering the JDK is the first step to learning Java. The most mainstream JDK is the JDK released by Sun, and in addition to sun, many companies and organizations have developed their own JDK, such as Jrocket, a JDK,BEA company developed by IBM, and a JDK developed by the GNU organization. Where IBM's JDK contains a JVM (Java Virtual machine) that runs much more efficiently than the JVM contained in the Sun JDK. The jrocket running on the x86 platform is also much more efficient than the sun JDK on the service side. But in any case, we need to get the sun JDK in the first place.

1. Download and install the JDK
The JDK is also called J2SE (Java2 SDK standard Edition), which can be downloaded from the Sun's Java Web site, http://java.sun.com/j2se/downloads.html, The latest version of JDK is j2sdk1.4.2, it is recommended to download the version of the JDK, download page here: http://java.sun.com/j2se/1.4.2/download.html.

The downloaded JDK is an executable installer that installs a set of JRE (for browser use) in the C:\Program files\java\ directory and installs a JDK (including a set of JRE) under C:\j2sdk1.4.2 under the default installation. Then we need to add the Java path C:\j2sdk1.4.2\bin to the front of the environment variable path. The JDK is ready to install.

2. Command Tools for JDK
The most important command-line tool for the JDK:
java: Start JVM execution Class
Javac:java Compiler
Jar:java Packaging Tools
Javadoc:java Document Generator
These command lines must be very familiar and proficient for each parameter. For the learning of these commands, there are detailed documentation on the JDK documentation.


Second, JDK documentation

documentation also has a download connection on the download page of the JDK, and it is recommended to download documentation. Documentation is one of the most important programming manuals, covering all aspects of Java's content description. It can be said that learning Java programming, most of the time is spent looking at this documentation above. I am carrying, write Java code, at any time to view, a moment not to leave the hand.


Application servers (app server)

App Server is the platform for running Java Enterprise Components, which forms the main operating environment of the application software. The current mainstream app server is Bea's WebLogic server and IBM's WebSphere and free JBoss, choose one to study on it, personally recommend WebLogic, because its architecture is cleaner, Development and deployment are more convenient and are the preferred development platform for Java enterprise software developers. Here's a brief introduction to several common app servers:

1. Tomcat
Tomcat is strictly not a real app server, it's just a web container that can support running serlvet/jsp, but Tomcat also extends some of the features of app server, such as Jndi, database connection pooling, user transaction processing, and so on. Tomcat is very widely used in small to medium-sized Java Web applications, so this article does a little about downloading, installing, and configuring Tomcat:

Tomcat is a sub-project under the Jakarta Project under the Apache organization, and its main site is: http://jakarta.apache.org/tomcat/, The latest version of Tomcat is Tomcat4.1.27, the connection for software downloads is: http://www.apache.org/dist/jakarta/tomcat-4/binaries/.

download Tomcat can either download the zip package directly, or download the EXE installation package (personal advice zip cleaner), in either case, the download is complete after the installation (Zip Direct decompression is OK). Two environment variables need to be set:

java_home=c:\j2sdk1.4.2
CATALINA_HOME=D:\TOMCAT4 (your Tomcat installation directory)

This installs, launches the Tomcat run Catalina_home\bin\startup.bat, closes the Tomcat run Shutdown.bat script. After Tomcat is started, 8080 ports are used by default, so you can use your browser to access http://localhost:8080 to test whether Tomcat starts properly.

Tomcat provides two web interface management tools, the URLs are:
http://localhost:8080/admin/index.jsp
http://localhost:8080/manager/html
Before you enable these two administrative tools, you need to 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:





This allows the user "Robbin" to have Super Administrator privileges. After you restart Tomcat, you can use that user to log in to the two administrative tools on the Web for Tomcat configuration and management.

2. BEA Weblogic
WebLogic can go to Bea's website for free to download to the latest Weblogic8.1 Enterprise Edition, license free to use 1 years, in fact, this is completely enough. Download connection for WebLogic: Http://commerce.bea.com/index.jsp,Weblogic's online document: http://edocs.bea.com/.

3. IBM Webshpere
WebSphere can also be downloaded to a free trial version of IBM's Developerworks website to see the download of WebSphere trial products and related WebSphere data, DeveloperWorks Chinese website is connected to: 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, open source app Server that can be downloaded free of charge from the JBoss website: http://www.jboss.org/index.html, but JBoss documentation is not free and needs to be paid for, so there are some hurdles to learning about JBoss. There are several good JBoss configuration documents on Jdon, which can be used for reference: http://www.jdon.com/idea.html


IV. Operating environment for Java applications

Java applications can be easily divided into the following areas:

1. Desktop applications for Java
desktop applications generally require only the JRE support to be sufficient.

2. Java Web Application
Java Web Apps require at least a JDK and a web container (such as Tomcat), and a multiuser database, with at least three layers of web apps:
Browser layer: Browser display user page
Web tier: Running servlet/jsp
DB layer: Back-end database, providing data access services to Java programs

3, Java Enterprise-class applications
enterprise applications are more complex and can be scaled to n-tier, with the simplest case being divided into 4 tiers:
Browser layer: Browser display user page
Client layer: the Java Client graphics program (or the embedded device's program) interacts directly with the Web layer or the EJB layer
Web tier: Running servlet/jsp
EJB layer: Run EJB to complete business logic operation
DB layer: Back-end database, providing data access services to Java programs

4. Java Embedded Application
Java Embedded application is a burgeoning field, engaged in embedded development, need to download the J2ME development package from Sun, J2ME contains the embedded device dedicated virtual machine KVM, and the common JDK contains a different JVM. There is also a need to download the simulator to a specific embedded vendor.


Java Learning Path (ii), book chapter

learn a new knowledge, can not expect to read only one, or two books will be able to fully grasp. There is a need for a gradual reading process. I recommend the Java Series books published by OReilly.

here I just want to add that a lot of people learn Java from the "Thinking in Java" This book, but I think this book is not suitable for beginners. I think the correct way to use the book should be as a supplementary reading. "Thinking in Java" is not a complete introduction of the entire Java system, but a kind of jumping writing method, is a kind of tips-like approach to a lot of Java knowledge points in-depth analysis and interpretation.

for beginners, it is best to find a Java primer book, but a more complete sequential introduction of Java syntax, object-oriented features, core class library and so on, while reading this book, you can simultaneously see "Thinking in Java", To deepen the understanding of Java and the use of principles, but also a complete understanding of the entire Java system.

for Java's introductory book, Cai recommends OReilly's "Exploring Java, 2nd Edition" or "Java in a nutshell,2nd Edition (for C + + backgrounds)" And I have not read these two books. In fact, I think the electronics industry publishing House "Java 2 programming detailed" or "Java 2 from the beginning to mastery" is very good.

of All the Java books, in fact, the most useful, not O ' Reilly Java serials, the real most useful is the JDK documentation! Almost all of the knowledge you want to get in the documentation, the most important part of course is the Java Basic Library API documentation, is organized according to the package, for each class has a detailed explanation, its inheritance relationship, whether to implement an interface, It is often used in the context of all of its public properties and methods, the interpretation of each property, the meaning, the purpose of each method, the parameters of the call, the meaning of the parameter, the type of the return value, and the exception that the method might throw, and so on. In this way, all of the books on Java programming are simply using the more understandable language and good organization to introduce the use of some of the classes contained within a package in documentation. So original aim, if you have enough ability to learn the Java library directly through documentation, then basically you don't need to look at other books. In addition, documentation is also a programming prerequisite manual, my desktop has three documentation shortcuts, The documentation of the j2sdk1.4.1 documentation,servlet2.3 documentation and j2sdkee1.3.1 respectively. With this three documentation, no other books are needed.

for Java WEB Programming, the core is to be familiar with the HTTP protocol, this is not related to Java, after familiarity with the HTTP protocol, you need to familiarize yourself with the Java implementation of the HTTP protocol class library, which is the servlet API, So the most important thing is the servlet API. Of course, for beginners, it is very difficult to learn web programming directly through the Servlet API, and I recommend O ' Reilly's Java Server Pages to learn Web programming.

EJB Books, "Enterprise JavaBeans, 2nd Edition" is a very good book, EJB learning threshold is relatively high, the entry is difficult, but this book completely reduced the difficulty of learning, particularly important is that, EJB learning needs to combine a specific implementation of an app server, so while learning EJBs, you have to learn some kind of App server in sync, and this book is about three books. weblogic6.1,websphere4.0 and JBoss3.0, respectively, are examples of the implementation of the above deployment books. It is true that there is both theory and practice. While learning EJBs, you can look at the side and do it, and EJB learning becomes easy.

But this book also has a problem, is the version is older, mainly talk about EJB1.1 specifications and part of the EJB2.0 norms. and Ed Roman wrote "Mastering EJB 2.0" This book is written according to EJB2.0 specifications, in layman's terms, covering all aspects of EJB programming, and there are many programming experience tips, is also learning EJB is one of the most recommended books.

if the combination of Weblogic to learn the Java EE, the "Java EE application and bea Weblogic Server" is definitely the preferred reading, Although the Weblogic6.0 is still worth buying, the book is the official recommended by BEA, and the author is also an engineer of BEA company. Now the Chinese version is everywhere. This book combines weblogic to introduce the development and deployment of various aspects of the Java EE technology on the WebLogic platform, and the practical guidance is very significant.

after mastering the basic knowledge of Java platform and the knowledge of EE, it is further to learn how to use Oo method to design software, then we must learn "design pattern". Sun has published a copy of the Java EE Core model, which is a must-have book for every architect who develops the software for the Enterprise platform. This book comprehensively introduces the various design patterns of the Java EE Architecture and is a must-read book for designers.

Java Learning Path (iii) process

Everyone's learning method is different, one's method is not suitable for another person, I can only talk about their own learning methods. Because I study Java is completely self-taught, never asked others, so the process of learning is basically completely self-groping out. I also do not know whether this method is a better method, can only provide a little reference for you.

The first step in learning Java is to install the JDK and write a Hello world. In fact, JDK learning is not so simple, there are two problems with JDK is easy to always haunt the Java Programmer's Place: One is classpath problem, in fact, in principle, is to figure out how the JRE's ClassLoader load class, and the other is the package and import issues, and how to find the classpath of the class. By figuring out these two questions, you're removing the biggest hurdle to learning Java and using the JDK. It is recommended to take a look at Sen Wang's "Deep Adventures in Java" and discuss these two issues in depth.

The second step is to learn the Java syntax. Java syntax is Class C + +, basically the mainstream programming language is not Class C, is the class C + +, there is nothing new, so the grammar of learning, probably half a day is enough. The only thing to note is that there are several key words that are not easy to figure out, public,protected,private,static, when to use, why to use, how to use, this may need someone to point out, I was completely self-figured out, took a long time. But then I saw the book "Thinking in Java", which was about these concepts.

The third step is to learn the characteristics of Java's object-oriented programming language. such as inheritance, constructors, abstract classes, interfaces, methods of polymorphism, overloading, overwriting, Java exception handling mechanism. For a person who does not have an object-oriented language background, I think this process takes a long time, because learning Java before the C + + experience, only C experience, I was about one months or so, just thoroughly put these concepts are clear, the book above the examples of repeated thinking, modify, try, The chapters of the content of the repeated look over, look at the past, see not more than 5 times, just thoroughly understand. But I think if there is a C + + experience, it should be two days enough time. So in this process, you can see more "thinking in Java" This book, the object-oriented explanation is very thorough. Unfortunately, I studied, and did not see the book, so I spent a lot of time, through their own attempts and try to learn.

The fourth step is to get familiar with Java's class libraries. Java's base Class library is actually the JDK installation directory under Jre\lib\rt.jar this package. Learning Basic Class Library is learning Rt.jar. There are very many classes in the base Class library. It is said that there are more than 3,000, I have not counted. But there are only 4 of us who really have the core,
java.lang.*;
java.io.*;
java.util.*;
java.sql.*;

The four-pack study, each package of learning can be written in a thick textbook, and O ' Reilly did do so. I think if the time is tight, it is impossible to learn by reading four books. I think the better way to learn is this:
The first thing to do is to read through the entire package framework, to understand the class,interface,exception of the entire packages, preferably to find articles that introduce the entire framework. The first few chapters of these specially introduced books should be the overall framework.

The grasp of the overall framework of the package is not to be familiar with the usage of each class, but to remember what properties and methods it has. I can't remember it. Instead, you need to know what kinds of classes are part of the package, what these classes are used for, and what functions the core classes are doing. I usually teach a package at a time, so it is not possible to describe the usage of each class in detail, but I have repeatedly stressed that I am telling you these packages not to tell you how the method of the class is called, nor do you want to remember the method invocation of the class, but rather you know what classes Java gives us. Each class is used in what circumstances, when I encounter problems, I know which class, or which combination of classes can solve my problem, that ' all! , as long as you know which class to use to complete your work, when we write the program specifically, it's enough. When coding, the specific method calls, is the side write code, side check documentation, all the things are in the documentation inside, do not require you must remember, the actual you also can not remember more than 3,000 classes of a total of nearly 100,000 method calls. Therefore, the grasp of the overall framework of each package becomes extremely important.

The fifth step, through the above study, if the study of a more solid, then lay the foundation of Java, the rest of the work is to clear the documentation inside, in addition to the above 4 packages of other useful classes. I believe that progress to this step, Java's self-learning ability has been cultivated, can be directly to learn the level of documentation. In addition to GUI programming, the other packages that will be useful in the JDK are these:
java.text.*;
java.net.*;
javax.naming.*;
These packages really use more than a few of the classes, only a few, so do not need to spend a lot of time.

Sixth step, Java Web programming
the core of Web programming is the HTTP protocol, the HTTP protocol and Java-independent, if not familiar with the HTTP protocol, although you can learn servlet/jsp programming, but not to extrapolate, follow realm. So the learning of HTTP protocol is necessary. If you are familiar with the HTTP protocol, but also have a good foundation of Java programming, Learning servlet/jsp is simply easy, I learned to use less than a week servlet/jsp, and then began to use JSP to do the project.

in Servlet/jsp's study, the documentation is still the servlet. The most commonly used classes of Servlet APIs are few and take less time to master. Read through all these classes and try to write a few more examples. The essence of servlet/jsp programming is to call these classes repeatedly to talk over the HTTP protocol between Web server and brower. In addition to the JSP, also need to be familiar with a number of commonly used JSP tags, the specific way to remember the words, temporary check just.

In addition, Java Web Programming learning focuses on Web application design patterns, how to conduct business logic analysis, and reasonable design, according to the MVC design pattern requirements, using servlet and JSP to complete different logic layer, Learn how to control and share data between Servlets and JSPs, and how Web application should be configured and deployed.

Seventh Step, Java EE programming
The above learning process if it is more smooth, to this step, the difficulty is suddenly improved. Because the above knowledge content is only involved in one aspect, and like EJB,JMS,JTA, such as the core of the Java EE specification is often a combination of the use of a number of technologies, the crystallization, so it is difficult to grasp the larger.

first of all must learn good Jndi,jndi is the app server location server resources (EJB component, DATASOUCE,JMS) lookup method, if the Jndi is unfamiliar, ejb,jms these things almost can't learn to go on. Jndi is actually javax.naming.* this package, it is very simple to use. The difficulty lies in the configuration of the server resource file. For the configuration of server resource files, it is necessary to look at the specific document specification, such as the writing of Web. XML, Ejb-jar.xml and so on. For each of the different app servers, there are also your own service resource profiles that you need to be familiar with.

you can then learn JTA, primarily to understand JTA's approach to transaction control, and where to use JTA. Here is a simple example, we know that the general situation can be used for a database connection transaction control (Conn.setautocommit (False),...., Conn.commit ()), as an atomic operation, But suppose my business requirement is to take operations on two different databases as an atomic operation, can you do that? At this time can only use JTA. Assuming that the operation is to first insert a record into a database, and then delete the B database another record, we write our own code is not control the entire operation as an atomic operation. With JTA, the app server is used to complete the control.

learning about object serialization and Rmi,rmi is the basis of EJB before learning EJB. Following the study of JMS and EJB, the most important thing for EJBS is to understand how EJBS implement calls to remote objects through RMI, and under what circumstances EJB is used.

after learning to ejb,jms these things, you may realize that you are impatient to learn two areas of knowledge, one is UML, the other is design Pattern. Java enterprise Software Design attaches great importance to the design of the framework (framework), a good software framework is the prerequisite for the success of software development. At this time, should begin to focus on the study of design patterns and framework learning, through learning and practical programming experience to master the EJB design patterns and the core model of the Java EE.

The Java EE specification inside, besides EJB,JMS,JTA,SERVLET/JSP,JDBC also has many many enterprise technology, here does not introduce each one.

There is also a new domain Web Services. Web Services also has nothing new, it is like a binder that can unify different services to provide a unified calling interface, as a user, I just get the service provider to my WSDL (description of the service), enough, I have no idea whether the services provided by the server provider are EJB components or. NET components, or what CORBA components, or any other implementations, I don't need to know. The greatest place in WEB services is the sharing of the entire Internet service through a unified service delivery and invocation, which is a very exciting technology area. Web services seem to have no good books at the moment, but they can be learned by looking up data on the web.

Java Learning Path (iv) method

Java as a programming language, the best way to learn is to write code. When you learn a class, you can write a simple example of the program to run, see what results, and then call a few more classes of methods, see the results of the operation, so very intuitive to the class to learn, and memory is very deep. Then you should not be satisfied to put the code to pass, you should think about if I do not write this, another way, try again trial not. Remember which tall man said that learning programming is a destructive process, the book examples, their own learning documentation written examples in the run through, and constantly try to use different methods to achieve, and constantly try to destroy the structure of the code, see what the results. In this way, you will be thoroughly proficient in mastering Java.

For example, we've all compiled Hello world.

Public class HelloWorld {
Public static void Main (string[] args) {
System.out.println ("Hello World";



Many beginners do not understand why the main method must define public static void main (string[] args), can not write this? Including when I was just studying Java, there was this kind of doubt. Do you want to know the answer? Very simple, you have to change the main name to run, to see what errors, and then based on the error message analysis, the main public to take off, in the try, report what error, static remove can not run, do not know whether the main method must pass a string[] array, String[], change to int[], or string to try, do not know whether to write the args parameter name, you can also change the args to another name, see how the results of the operation.

I did this when I learned Java, the Hello World program repeatedly changed seven or eight times, constantly running, analysis of running results, finally thoroughly understand why the main method is so defined.

In addition, I do not understand the staic,public,private,exception,try{}catch {}finally{} and so on, and so on, all the examples of reference books run successfully, and then began to destroy it, Constantly according to their own heart of the question to rewrite the program, to see if it can run, run out what it looks like, whether you can get the expected results. This is a time-consuming process, but one example of this is repeated destruction several times. I have learned a thorough knowledge of the relevant information. Sometimes it is even intentional to write some wrong code to run and see if you can get the expected run error. So the mastery of programming is profound.

It is particularly noteworthy that the JDK has a very good debugging function,-verbose
Java–verbose
Javac–verbose and many other JDK tools have this option
-verbose can show how the JVM loads the class in sequence as the command executes, and with these valuable debugging information, it helps us to analyze what the JVM has done in the course of execution.

In addition, in the course of their own learning, write a lot of this destruction routine, should have the consciousness of the categories of preservation, in the work of the accumulation of typical routines should also be regularly collated, accumulate, and have a code base. In the case of similar problems, it is good to Copy & Paste, Search & Replace in the code base, greatly improving the development speed. Ideally, some of the general routines themselves can be abstracted to form a common class library, which is packaged well. Then reusability is even stronger.

so I think it is not particularly need routines, the destruction of their own routines is the best example, if you really do not worry about the code you write, I highly recommend you look at the JDK base Class library Java source code. Under the JDK installation directory there will be a src.zip, to be able to fully see the entire JDK base Class library, that is, Rt.jar Java source code, you can refer to how Sun wrote Java program, specification is what it looks like. When I am learning Java library, when some places do not understand very clearly, or want to understand the details of the operation more clearly, often open the source code of the corresponding class, by looking at the source code, all the problems will be swept away.

Java Learning Path (v) resource Chapter

1. http://java.sun.com/(English)
Sun's Java Web site is a place that should often be seen. Don't say much.

2, http://www-900.ibm.com/developerWorks/cn/
IBM's Developerworks website, English good directly to the English main site to see. This is not only a very good object-oriented analysis of the design of the site, but also the Web services,java,linux excellent site. Highly Recommended!!!

3. http://www.javaworld.com/(English)
discussion and news about many new technologies in Java. It's good to know more about the application of Java in every aspect.

4, http://dev2dev.bea.com.cn/index.jsp
Bea's developer corner, Bea, as the most important app server vendor, has a lot of unique technology, not to be missed on the WebLogic development of friends.

5, http://www.huihoo.com/
Gray Fox Power website, a professional middleware web site, although not a professional Java Web site, but in the EE enterprise application technology has deep attainments.

6. http://www.theserverside.com/home/(English)
Theserverside is a well-known web site specifically for Java server-side applications.

7, http://www.javaresearch.org/
Java Research Organization, there are a lot of good Java aspects of the text

Java Learning Route

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.