Getting Started with Java-A brief introduction to Java learning from getting started to mastering "turn"

Source: Internet
Author: User
Tags connection pooling object serialization jboss ibm developerworks

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 anyway, we still 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 Filesjava 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.2bin 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 Apache, 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_homebinstartup.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_homeconftomcat-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 download to the free trial version, to the IBM Developerworks website can see the WebSphere Trial product download and the related WebSphere material, the Developerworks Chinese website Connection 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, open source app Server that can be downloaded from the JBoss website for free: http://www.jboss.org/index.html, but JBoss docs are not free and need to be paid for, So we set a certain hurdle for 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, At the same time, we can fully understand the whole 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 acquire in 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, whether to implement an interface, pass Commonly used in which occasions, you can also find all of its public properties and methods, the interpretation of each property, meaning, the purpose of each method, the parameters of the call, the meaning of the parameter, the type of return value, and the method may throw exceptions 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 there is no need to read any other books. In addition, documentation is also a programming prerequisite manual, my desktop has three documentation shortcuts, respectively j2sdk1.4.1 documentation,servlet2.3 Documentation and j2sdkee1.3.1 's documentation. 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, 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, especially important is that EJB learning needs to combine an app The implementation of the server, so while learning the EJB, you must synchronize the learning of some kind of app Server, and this book related to the three books, respectively, weblogic6.1,websphere4.0 and JBoss3.0 above the example of the implementation of the book. 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 it is combined with 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, this book is the official BEA recommended textbook, the author is Bea's engineer. 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, the further is to learn how to use Oo method for software design, then 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 shape to make quail play?? The dark tomb of the old Yin? Joe Falcon Blow G N b to restore? Le an address pepper ㄊ owe lined latent ran shrimp pepper ǎ? Ji Bad ┮? The first step in learning Java is to install the JDK, write a Hello world,? In fact, the JDK learning is not that simple, about the JDK has two problems is easy to always haunt the Java Programmer's Place: One is the classpath problem, in fact, in principle, is to figure out how the JRE ClassLoader is loaded class Another problem is the package and import issues, 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 no new things, 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, for what 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. 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 Jrelibrt.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. But to know what aspects of the package are composed of classes, the purpose of these classes are what, the core of a few classes are to accomplish what function. I usually teach a package in a class, so it is not possible to introduce the use of each class in detail, but I have repeatedly stressed that I am telling you these packages are not to tell you how the method of the class is called, do not require you to remember the method invocation of the class, but you understand that Java provides us with what classes, Each class is used on what occasions, 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.

The sixth step, Java Web Programming, the core of Web programming is the HTTP protocol, HTTP protocol and Java-independent, if not familiar with the HTTP protocol, although can also 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 to use JTA on any occasion. Here is a simple example, we know that the general situation can be for a database connection transaction control (Conn.setautocommit (False),...., Conn.commit ()), as an atomic operation, but suppose my industry The business requirement is to take the operation of 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 the invocation of remote objects through RMI and, in what circumstances, to use EJBS.
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's like a binder that unifies different services to provide a unified calling interface, and as a user, I just get the WSDL (description of the service) that the service provider gave me, and that's enough, I have no idea whether the services provided by the server provider are EJB components or. NET components, or what CORBA components, or other implementations, I do not 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.

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. In the JDK installation directory, there will be a src.zip, you can fully see the entire JDK base Class library, that is, Rt.jar Java source code, you can refer to the sun is how to write Java program, the specification is what look. 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.

Getting Started with Java-A brief introduction to Java learning from getting started to mastering "turn"

Related Article

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.