Java learning from introduction to mastery
Java learning path (I), tool Article 1 and JDK (java development kit) JDK is the core of the whole Java, including Java runtime environment, a pile of java tools and java basic class libraries (rt.jar). No matter what Java application server is, a version of JDK is built in. 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, jrocket developed by BEA, JDK developed by GNU, etc. The JVM (Java virtual machine) included in IBM's JDK is much more efficient than the JVM included in sun JDK. The jrocket specially running on X86 platform is also much more efficient than sun JDK on the server side. However, we still need to Master Sun JDK first. 1. JDK download and installation is also called J2SE (Java2 SDK Standard Edition), which can be downloaded from sun's Java website, http://java.sun.com/j2se/downloads.html , the latest version of JDK is j2sdk1 4.2. It is recommended to download this version of JDK. The download page is here: http://java.sun.com/j2se/1.4.2/download.html 。 The downloaded JDK is an executable installer, After the default installation, a set of JRE (for the browser) will be installed in the C: program FilesJava directory, and a set of JDK will be installed in C: j2sdk1.4.2 (including a set of JRE). Then we need to add the Java path C: J2SDK 1.4.2in at the front of the environment variable path. In this way, the JDK will be installed. 2. JDK command tool JDK's most important command line tool: Java: start the JVM and execute class javac: Java compiler jar: Java packaging tool Javadoc: Java document generator. These command lines must be very familiar , you should be proficient in each parameter. For the learning of these commands, there are detailed documents on JDK documentation. 2、 JDK documentation also has a download connection on the JDK download page. It is recommended to download documentation at the same time. Documentation is the most important programming manual, covering the description of all aspects of the whole Java. It can be said that most of the time spent learning java programming is spent watching this documentation. I carry it with me. When I write java code, I check it at any time and don't leave my hand for a moment. 3、 Application server (app server) app server is a platform for running Java enterprise components and constitutes the main running environment of application software. At present, the mainstream app servers are BEA's WebLogic Server, IBM's WebSphere and free JBoss. Just choose one of them to learn. I personally recommend Weblogic because its architecture is cleaner and easier to develop and deploy. It is the preferred development platform for Java enterprise software developers. The following is a brief introduction to several commonly used app servers: 1. Tomcat Tomcat is not a real app server in the strict sense. It is just a web container that can support running servlet / JSP. However, Tomcat also extends the functions of some app servers, such as JNDI, database connection pool, user transaction processing, etc. Tomcat is widely used in small and medium-sized Java Web applications. Therefore, this paper introduces the download, installation and configuration of Tomcat: Tomcat is a sub project of Jakarta project under Apache organization. Its main website is: http://jakarta.apache.org/tomcat/ , the latest version of Tomcat is Tomcat 4 1.27. The connection of software download is: http://www.apache.org/dist/jakarta/tomcat-4/binaries/ 。 To download tomcat, you can either directly download the zip package or download the EXE installation package (I suggest that the zip be cleaner). In either case, after the download and installation is completed (zip can be directly decompressed). You need to set two environment variables: java_home = C: j2sdk1.4.2 catalina_home = D: omcat4 (your Tomcat installation directory), Start Tomcat and run Catalina_ HOMEinstartup. Bat, close Tomcat and run shutdown Bat script. After Tomcat is started, port 8080 is used by default, so it can be accessed by browser http://localhost:8080 To test whether Tomcat starts normally. Tomcat provides two web interface management tools. The URLs are: http://localhost:8080/admin/index.jsp http://localhost:8080/manager/html Before enabling these two management tools, you need to manually configure the administrator user and password. Open Catalina with a text tool_ HOMEconf omcat-users. XML file, add the following lines: < role rolename = "manager" / > < role rolename = "admin" / > < user username = "Robbin" password = "12345678" roles = "admin, manager, Tomcat" / > so that the user "Robbin" has super administrator privileges. After restarting tomcat, you can use the user to log in to the above two management tools to configure and manage Tomcat through the web. 2. BEA Weblogic Weblogic can register on BEA's website for free and download to the latest weblogic8 1. For the enterprise version, the license can be used for free for one year. In fact, this is completely enough. Download connection of Weblogic: http://commerce.bea.com/index.jsp ,.../ edocs. bea. com/ 。 3. IBM WebSphere can also be downloaded to the free trial version. You can see the download of WebSphere trial products and relevant WebSphere materials on the IBM developerWorks website. The connection to the developerWorks Chinese website is: http://www-900.ibm.com/developerWorks/cn/wsdd/ , download connection to WebSphere: http://www7b.software.ibm.com/wsdd/...WASsupport.html 。 4. JBoss JBoss is a free and open source app server that can be downloaded from the JBoss website for free: http://www.jboss.org/index.html , of course n.com/idea. HTML IV. running environment of Java applications Java applications can be simply divided into the following aspects: 1. Java desktop applications desktop applications generally only need the support of JRE. 2、 Java Web applications Java Web applications need to install at least JDK and a web container (for example, Tomcat) and a multi-user database. The web application is divided into at least three layers: Browser layer: browser displays user pages, web layer: running servlet / JSP DB layer: back-end database to provide data access services to Java programs. 3. Java enterprise application enterprise application is more complex and can be extended to N layers. In the simplest case, it will be divided into four layers: Browser layer: browser Display user page client layer: Java client graphics program (or embedded device programs) directly interact with the web layer or EJB layer. Web layer: run servlet / JSP. EJB layer: run EJB to complete business logic operation. DB layer: back-end database to provide data access services to Java programs. 4. Java embedded application Java embedded application is an emerging field. To engage in embedded development, you need to download J2ME development package and J2ME package from sun It includes the special virtual machine KVM for embedded devices, which is different from the JVM contained in the ordinary JDK. In addition, you need to download the simulator from a specific embedded manufacturer. Java learning path (II). Books: learning a new knowledge cannot be expected to be completely mastered by reading only one or two books. There needs to be a step-by-step reading process. I recommend the java series books published by oreilly. Here I just want to add a point. Many people learn java from thinking in Java I started with this book, but I don't think it is suitable for beginners. I think the correct way to use this book should be as an auxiliary reading. Thinking in Java is not a complete introduction to the whole system of Java, but a jumping writing method. It is a method similar to tips to deeply analyze and explain many knowledge points of Java. For beginners, it's best to find a book on Java, but a relatively complete and sequential introduction to Java syntax, object-oriented features, core class libraries, etc. while reading this book, you can watch thinking in Java at the same time, so as to deepen the understanding and application of Java principles, and fully understand the whole system of Java. For introductory books on Java, Cai Xueyong recommended oreilly's exploring Java, 2nd edition or Java in a nutshell, 2nd Edition (for C + + background). I haven't read these two books. In fact, I think the detailed explanation of Java 2 programming or Java 2 from introduction to mastery by the electronic industry press It's good. Among all Java books, the most useful one is not O'Reilly's java series. The most useful one is JDK documentation! Almost all the knowledge you want to obtain is in the documentation. Of course, the most important part is the API document of the java basic class library, which is organized according to the package. There are detailed explanations for each class, its inheritance relationship, whether it implements an interface, which occasions it is usually used, and all its public properties and methods can be found, The explanation and meaning of each attribute, the purpose of each method, the parameters called, the meaning of the parameters, the type of return value, and the exceptions that the method may throw, etc. It can be said that all books on Java programming are actually just introducing the usage of some classes contained in a package in documentation in a relatively easy to understand language and good organization. If you have enough ability to learn java class libraries directly through documentation, you basically don't need to read other books. In addition, documentation is also a necessary manual for programming. There are three shortcuts to documentation on my desktop, j2sdk1 4.1 documentation, servlet2 3 documentation and j2sdkee1 3.1 documentation. With these three documentations, no other books are needed. For Java Web programming, the most important 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's class library for implementing the HTTP protocol, that is, servlet API, so the most important thing is Servlet API. Of course, it is very difficult for beginners to learn web programming directly through servlet API. I recommend O'Reilly's Java server pages to learn web programming. Among the EJB books, Enterprise JavaBeans, 2nd Edition is a very good book. The learning threshold of EJB is relatively high and it is difficult to get started. However, this book completely reduces the difficulty of learning. What is particularly important is that the learning of EJB needs to be combined with the specific implementation of an app server. Therefore, while learning EJB, you must learn a certain app server synchronously, There are three books related to this book, Weblogic 6 1,Websphere4. 0 and JBoss 3 0 the implementation of the example in the deployment book above. It really has both theory and practice. While learning EJB, you can do it while watching. EJB learning will become very easy. But this book also has a problem, that is, the version is relatively old, mainly about EJB 1 1 specification and part EJB2 Specification for 0. The Book Mastering EJB 2.0 written by ED Roman is completely based on EJB 2.0 0 specification, which covers all aspects of EJB programming, and has a lot of programming experience tips. It is also one of the highly recommended books for learning EJB. If it is combined with Weblogic