[Reserved] Java learning from getting started

xiaoxiao2021-03-06  60

Author: robbin URL: http: //hibernate.fankai.com/Java Learning Path (a), a tool articles, JDK (Java Development Kit) JDK is the core of the whole Java, including Java runtime environment (Java Runtime Envirnment), A bunch of Java tools and Java base libraries (RT.jar). Regardless of the Java application server, it is built into a version of JDK. So master JDK is the first step in learning Java. The mainstream JDK is the JDK released by Sun. In addition to Sun, many companies and organizations have developed their JDK, such as the JDKTed by IBM, BEA's JROCKET, as well as GNU organizations, etc. . The JVM (Java Virtual Machine) of the IBM's JDK is much higher than the JVM contained in Sun JDK. Jrockets running in the X86 platform are also much better than Sun JDK in the X86 platform. But no matter what, we still need to master Sun JDK first. 1, JDK download and installation JDK is called J2SE (Java2 SDK Standard Edition), you can download 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 the version of JDK, download page here: http://java.sun.com/j2se/1.4.2/download.html. Downloading JDK is an executable installer, the default installation will be installed in the C: / Program files / java / directory, install a set under C: /J2SDK1.4.2 JDK (also included a set of JRE). Then we need to increase Java path C: /J2SDK1.4.2/bin at the forefront of the environment variable Path. This way, JDK is installed. 2, JDK command tool JDK's most important command line tool: Java: Start JVM execution classjavac: Java compiler JAR: Java Packing Tool Javadoc: Java Document Builder These command lines must be very familiar, for each parameter Very proficient. For these commands, there is a detailed documentation on the JDK Documentation. Second, JDK DocumentationDocumentation also has downloaded connections in JDK downloads, and it is recommended to download Documentation at the same time. Documentation is the most important programming manual covers the description of all Java all aspects. It can be said that learning Java programming, most of the time is watching this documentation. I am carrying it with you, when I write Java code, I will see it at any time. Third, the App Server App Server is a platform that runs Java Enterprise Components, which constitutes the main operating environment of the application. The current mainstream App Server is a WebLogic Server and IBM's WebSphere and free JBOS, and one of them can be learned. Personally recommend WebLogic, because it is more convenient, developed and deployed, is Java Enterprise software developers preferred development platform.

The following brief introduces several common App Server: 1, Tomcattomcat is not a real app server, it is just a web container that can support running Server / JSP, but Tomcat has expanded some App Server features, such as JNDI. , Database connection pool, user transaction, etc. Tomcat is very widely used in small and medium-sized Java web applications, so this article does a little download, install, and configure Tomcat: Tomcat is a sub-project under the Jakarta project under Apache, 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/. Download Tomcat can download the ZIP package directly, you can also download the EXE installation package (personal suggestion zip cleaner), no matter which case, after downloading (ZIP direct decompression). Need to set two environment variables: java_home = c: /j2sdk1.4.2catalina_home=d: / tomcat4 (your Tomcat installation directory) This is installed, start Tomcat Run Catalina_Home / Bin / Startup.bat, close Tomcat Run Shutdown. BAT script. After Tomcat starts, the 8080 port is used by default, so you can use your browser to access http: // localhost: 8080 to test whether Tomcat is started normally. Tomcat provides management tools for two web interfaces. The URLs are: http: // localhost: 8080 / admin / index.jsp http: // localhost: 8080 / manager / html first needs before enabling these two management tools Manually configure the administrator user and password. Use a text tool to open Catalina_Home / conf / tomcat-user.xml, add the following line: This user" Robbin "has super administrator privileges. After restarting Tomcat, you can use the user to log in to the above two management tools, and perform Tomcat configuration and manage through the web mode. 2, BEA WebLogicWeblogic can be downloaded to the latest WebLogic8.1 Enterprise version after free on the BEA website, license can be used for free, in fact, this is complete enough. WebLogic download connection: http://commerce.bea.com/index.jsp ,../edocs.bea.com/.

3, IBM WebShpereWebsphere also downloads to free trial versions, to IBM's DeveloperWorks website You can see download and related WebSphere's data for WebSphere trial products, the connection of WebSphere, the site of the developerWorks Chinese website is: http://www-900.ibm. COM / west /, WebSphere downloads: http://www7b.software.ibm.com/wsdd/...wassupport.html. 4, jbossjboss is a free open source App Server, you can download from JBoss website: http://www.jboss.org/index.html, but ... n.com/idea.html 4, Java application running environment Java applications can be simply divided into the following aspects: 1. Java's desktop application desktop applications generally only need JRE support is sufficient. 2, Java Web Application Java's web application requires at least JDK and a web container (such as Tomcat), and a multi-user database, the web application is divided into three layers: browser layer: browser display User page Web layer: Run servlet / JSPDB layer: Back-end database, providing data access services to Java programs 3, Java enterprise application enterprise application is more complicated, can be extended to N layers, the simplest situation is divided into 4 layers: browser layer: Browser Display User Page Client Layer: Java client graphics (or program of embedded devices) Direct and web layer or EJB layer interact Web layer: Run servlet / jspejb layer: run EJB, complete business logic operation DB layer: backend database, provide Java programs Data Access Service 4, Java embedded application Java embedded application is an area of ​​Faise, engage in embedded development, need to download J2ME development kits from Sun, J2ME contains embedded device-specific virtual machine KVM, and ordinary JDK included JVM is different. It also needs to download the simulator to a specific embedded vendor. Java Learning Path (2), books learn a new knowledge, it is impossible to count on only one, or two books can be fully grasped. Need to have a step-by-step reading process. I recommend Oreilly published Java series books. Here I only want to add a point, many people learn Java, starting from "Thinking In Java", but I think this book is not suitable for beginners. I think the correct use of this book should be an auxiliary reading. "Thinking in Java" is not a complete introduction to Java's entire system, but a jumping writing method, a method similar to TIPS to analyze and explain a lot of Java's knowledge points. For beginners, it is best to find a book of Java entry, but more complete steps introduced Java grammar, object-oriented features, core class libraries, etc., while seeing this book, you can synchronize Look at "Thinking in Java" to deepen the use of Java's understanding and principles, while you can completely understand the entire system of Java. For Java's entry books, Cai Xueqi recommended is Oreilly's "Exploring Java, 2nd Edition" or "Java in A Nutshell, 2nd Edition", I haven't seen these two books.

In fact, I think the "Java 2 programming detailed explanation" or "Java 2 to be proficient" is very good. Among all Java books, it is most useful, not O'Reilly Java Serials, the most most useful place is the JDK Documentation! Almost all the knowledge you want is all in the documentation, the most important part of which is of course the API document of the Java underlying class library, which is organized according to Package, which has a detailed explanation for each Class, its inheritance Relationship, whether to implement an interface, which occasions are usually used, and you can find all the properties and methods of all the publications, the interpretation, meaning, the purpose of each attribute, the use of the parameters, the meaning of the parameters, The type of return value, and the exception that may be thrown. It can be said that all books in Java programming are actually in the use of more popular, easy-to-understand language, and good organizational methods to introduce some of the use of some classes contained in the Documentation in the documentation. Therefore, you will not leave the Zong. If you have enough ability to learn Java's class libraries through Documentation, then you don't need to see other books. In addition, Documentation is also a must-have manual, and there is three Documentation shortcuts on my desktop, respectively, Documentation, servlet2.3 Documentation, and J2SDKee1.3.1, respectively. Documentation. With this three documentation, what other books are not needed. For Java Web programming, the core is to be familiar with and master the HTTP protocol. This is not related to Java. After familiar with the HTTP protocol, you need to be familiar with Java's implementation HTTP protocol, which is the servlet API, so the most The important thing is the servlet API. Of course, for beginners, there is a big difficulty through the servlet API to learn Web programming, I recommend O'Reilly's "Java Server Pages" book to learn Web programming. In the book of EJB, "Enterprise Javabeans, 2nd Edition" is a very good book, EJB's learning threshold is relatively high, it is difficult to get started, but this book completely reduces the difficulty of learning, especially important, EJB Learning needs to be implemented in conjunction with an App Server, so in learning EJB, you must learn some kind of app server, and this book has three books, which is WebLogic6.1, WebSphere4.0 and Real as possible in JBoss3.0's deployment above. It is really theoretical and practical. While learning EJB, you can do it while you can do it, and EJB learning will become easier. But this book also has a problem, which is the old version, mainly talking about EJB1.1 norms and some EJB2.0 specification. The book written by ED Roman is completely written according to EJB2.0 specification, in-depth light, covering all aspects of EJB programming, and many programming experience Tips, is also one of the books that study EJB very recommended .

If you are learning J2EE in conjunction with WebLogic, "J2EE Application and Bea WebLogic Server" is definitely the first choice, although it is a description of WebLogic6.0, it is still worth buying. This book is a BEA officially recommended textbook. The author is a engineer of BEA. . The Chinese version is now visible everywhere. This book combines WebLogic to introduce J2EE's development and deployment on the WebLogic platform, and practical guidance is very strong. After mastering the basic knowledge of the Java platform and J2EE, it is further in learning how to use OO method for software design, so be sure to learn "design mode". Sun published a "J2EE Core Mode" is a book for each architect developing Java corporate platform software. This book fully introduces various design patterns of the J2EE architecture, which is a must-read book for designers. Java Learning Path (3) Process Everyone's learning method is different, and a person's method is not necessarily suitable for another person, I can only talk about my learning method. Because I learned that Java is completely self-study, I have never asked others, so the process of learning is basically completely exploited. I don't know if this method is a better way, I can only give you a point. The first step in learning Java is to install JDK. Write a Hello World. In principle, it is to figure out how JRE's ClassLoader loads Class; another problem is Package and Import issues, how to find the path problem of classes. Take all the two questions and clearly remove the biggest obstacles to learning Java and using JDK. It is recommended to look at Wang Sen's "Java Deep Adventures" and discuss these two issues. The second step is to learn the syntax of Java. Java's grammar is class C , basic mainstream programming language is not class C, which is class C , there is no new thing, so the language of grammar is probably a half-day time. The only thing you need to pay attention is to have a few use, public, protected, private, static, when used, why is it used, how to use it, this may need someone to point to it, I originally complete myself I spent a long time. But then I saw "Thinking In Java" this book talking about these concepts. The third step is to learn the characteristics of Java's object-oriented programming language. For example, inheritance, constructors, abstract classes, interfaces, polymorphisms, overloading, coverage, and Java exception handling mechanisms. For a person without an object-oriented language background, I think this process takes a long time, because I don't have C experience before Java, only C's experience, I spent about a month, I only thoroughly It is clear that these concepts are clear, try to figure out, revise, try, and see the contents of the chapters, seeing, can't see 5 times, it is completely realistic. But I think if there is C experience, it should be enough for a day or two. So in this process, you can see "Thinking in Java" book, which is very thoroughly explained to the object.

Unfortunately, when I learned, I didn't see this book, so I spent a lot of time, learning through my own trial and trying to learn. The fourth step is to start familiar with Java class libraries. Java's basic class library is actually the JDK installation directory below JRE / lib / rt.jar this package. Learning the underlying library is to learn RT.jar. There are very many classes in the base class library. It is said that there are more than 3,000, I have no statistics. But only four of the most core for us, respectively, Java.lang. *; Java.util. *; Java.sql. *; These four packages, each package Learning can be written into a thick textbook, and O'Reilly is indeed doing this. I think if the time is tight, it is impossible to learn from four books. I think the better learning method is this: first, you must read the entire package of package, understand the composition of the entire package, and Exception, it is best to find an article describing the entire package framework. The first few chapters of these special introduction packages should be the introduction of these overall frameworks. The grasp of the overall framework of the package is not to be familiar with each class, remember what properties, methods. I can't remember it. Instead, we must know what kinds of classes have a class, what is the use of these classes, and the most core of the core is done. When I gave it to the training, I generally speak a package, so I can't introduce the usage of each class, but I repeatedly stressed that I will tell you how to tell you how to call you. I don't ask you to remember the way the method is called, but I want you to know, what kind of Java provides us, every class is used, when I encountered a problem, I know which class, or Several combinations can solve my problem, That'All! When we write the program, as long as you know which class should be used to complete your job, it is enough. When encoding, the specific method is called, it is to write the code, check the documentation, all things are in the documentation, do not ask you to remember, actually can't remember more than 3,000 categories of total 100,000 methods transfer. Therefore, it is extremely important to grasp the grasp of the overall framework of each package. In the fifth step, through the above learning, if you are more solid, you have a foundation of Java, and the rest of the job is to clear the other more than 4 packs other than the 4 packs in Documentation. class. Believe this step, Java's self-study ability has been cultivated, and it can be reached the level of Documentation directly. In addition to doing GUI programming, other people in JDK will have access to them: java.text. *; Java.net. *; Javax.naming. *; These packages are really used in the package. There are only a few, so you don't need to spend a lot of time. In the sixth step, the core of Java Web programming web programming is the HTTP protocol, HTTP protocol and Java have nothing to do. If you are not familiar with the HTTP protocol, although you can also learn the servlet / JSP programming, but you will not reach the trip to one. So the learning of the HTTP protocol is essential. If you are familiar with the HTTP protocol, there is a good foundation for Java programming. Learning Servlet / JSP is easy, I have to use the servlet / jsp use less than a week, and then start with JSP to do projects. In the study of servlet / jsp, the weight is still servlet documentation.

The most common class of servlet API is very small, and it can be mastered. Take these classes to see several examples. Servlet / JSP Programming Nature is to call these classes repeatedly between Web Server and Brower through the HTTP protocol. In addition to JSP, you need to be familiar with several common JSP tags, and if you can't hold it, the temporary investment is. In addition, Java web programming learning is to be placed in the design mode of Web Application, how to analyze business logic, and conduct reasonable design, follow the requirements of MVC design mode, using servlet and JSP to complete different logical layers, master how The flow control and data sharing between servlet and JSP, and how Web Application should be configured and deployed. In the seventh step, the learning process of J2EE programming is more smooth, and the difficulty is difficult to improve. Because the above knowledge is only involved in one aspect, the J2EE specification such as EJB, JMS, JTA is often a crystallization of several Java technology, so it is relatively difficult to master. First, you must learn JNDI, JNDI is an App Server Location Server Resource (EJB Components, Datasouce, JMS) Finding Method, if you are not familiar with JNDI, EJB, JMS these things are almost university can't go. JNDI is actually javax.naming. * This package is easy to use. The difficulty is the configuration of the server resource file. For the configuration of the server resource file, you need to take a look at the special document specification, such as the WEB.XML of WEB.XML, EJB-JAR.XML Writings, and so on. For each different app server, there is also your own service resource profile, it is also familiar. You can then learn JTA, mainly to understand the method of JTA's control for transactions, and what is used in any occasion. Here you can make an example, we know that the general situation can be transactional for a database connection (Conn.commit (False), ...., as an atomic operation, but assumes me Business requirements are to make operations for two different databases as an atomic operation, can you do? At this time, I can only use JTA. Suppose the operation process is first inserting a record first to the A database, then deleting another record of the B database, our own writing code is not controlling the entire operation as an atomic operation. With JTA, the APP Server is used to complete the control. Learn to serialize and RMI before learning EJB, RMI is the basis of EJB. Then learn JMS and EJB. For EJB, the most critical is to understand how EJB is called by RMI to the call to the remote object, and in what circumstances to use EJB. After learning EJB, JMS these things, you may be aware of the knowledge of two fields, one is UML, and the other is Design Pattern. Java Enterprise Software Design is very valid to the framework design, and a good software framework is a necessary condition for software development. At this time, you should start the focus of learning in design patterns and frameworks, master EJB design patterns and J2EE's core mode through learning and practical programming experience. Inside the J2EE specification, there are many business technologies in addition to EJB, JMS, JTA, Servlet / JSP, JDBC, which is not introduced here. There is also a new field Web Services.

Web Services also does not have any new things, it is like a binder, you can unify different services to provide a unified call interface. As a user, I just get the WSDL for the service provider (on service Description), it is enough, I don't know if the service provider is EJB component, or is it .NET component, or what CORBA component, or other implementation, I don't need to know. The greatest place in Web Services is to achieve sharing of Internet services through unified service providing methods and calls, is a very exciting technical field. Web Services seems to have no good books, but can learn by checking information on the network. Java Learning Path (4) Methods Java As a programming language, the best learning method is to write code. When you learn a class, you can write a simple example program to run, see what results, then call a few classes, look at the run results, this is very intuitive to learn the class And the memory is very deep. Then you should not meet the transfer code, you should think about it, if I don't write, change it, try it again. Remember which talker said that learning programming is a destruction process, putting the examples in the book, learning the documentation, after running, constantly trying with different ways, constantly trying to destroy the structure of the code, see What is the result? In this way, you will be very universal to master Java. For example, we have compiled Hello WorldPublic Class HelloWorld {public static void main (string [] args) {system.out.println ("Hello World");}} Many beginners are not very understood why the main method must be like this To define public static void main (string [] args, can you write? Including that I have such questions when I just learned Java. Want to know the answer? Very simple, you change your name to run, see what the report is wrong, then analyze according to the error information; take the main PUBLIC, try to see, what is wrong; Static removes; don't know main Whether or not to pass a string [] array, change String [], change to int [], or string to try; do not know if you must write the Args parameter name, you can also change the args to another name, Look at how to run the results. I did this when I learned Java, I made the Hello World program for seven or eight times, constantly run, analyze the results, and finally understand why MAIN method is defined. In addition, I don't understand the beginning of Staic, Public, Private, Exception, Try {} catch {} finally {}, etc., etc., it is to run successfully on the example above, and then start to destroy it, constantly According to questions in your own heart, rewrite the program, see if it is possible to run, whether it looks like it, can you get expected results. Thus, although time is time, an example program has repeatedly destroyed several times. I have a thorough understanding of this related knowledge.

Sometimes even deliberately write some wrong code to run, see if it is expected to run error. This is to be profound for programming. It is particularly worth mentioning that JDK has a great debugging function, and the -verbose java -verbosejavac -verbose and many other JDK tools have this option --verbose can display where the JVM loads in turn, Through these valuable debugging information, you can help us analyze what JVM has done something during the execution. In addition, in the learning process, this destruction routine written, should be consciously divided into a separate class, the typical routine accumulated in the work should also be organized regularly, and there is a code base in the month. I have encountered a similar problem, to the Copy & Paste, Search & Replace in the code base, which greatly improves the development speed. The most ideal situation is to abstract some universal routines to abstract the first floor, form a universal class library, and have good packaging. Then it is more reusable. So I don't think it is not particularly necessary. If you write the destruction routine is the best example. If you really write the code you wrote, I highly recommend you to see the JDK underlying class library Java source code. In the JDK installation directory, there will be a src.zip, unope can completely see the entire JDK base class library, which is the Java source code of RT.jar, you can refer to how Sun is how to write Java programs, specification What is it like. When I study Java's class library, when some places are not very clear, or when you want more clear understanding of the details of the operation, you often open the source code of the corresponding class, through the source code, all The problem will be swept away. Java Learning Path (5) Resources 1, http://java.sun.com/ (English) Sun's Java website is a place where you should see. Don't say more. 2, http://www-900.ibm.com/developerWorks/cn/ IBM's developerWorks website, English is good to go to English main site. It is not only an excellent object-oriented analysis design website, but also a very good website of Web Services, Java, Linux. highly recommended! ! ! 3, http://www.javaworld.com/ (English) Discussions and news about many new technologies in Java. I want to know more about the roof of Java, which is better here. 4, http://dev2dev.bea.com.cn/index.jsp BEA's developer garden, BEA as the most important App Server manufacturer, there are many unique technologies, friends who do developed on WebLogic are not missed. 5, http://www.huihoo.com/ Gray Fantun Power Website, a professional middleware website, although not a professional Java website, but there is a deep attainment in J2EE business application technology. 6, http://www.theserverside.com/home/ (English) THESERVERSIDE is a famous website for Java Server applications. 7, http://www.javaresearch.org/ Java Research organization, there are many excellent Java articles and tutorials, especially in JDO articles. 8, http://www.cnjsp.org/ JSP technology website, there are quite a few JAVA articles and resources.

转载请注明原文地址:https://www.9cbs.com/read-113831.html

New Post(0)