How to Learn Java

Source: Internet
Author: User
Tags jboss

Recently, several friends on the Forum asked questions about how to learn java. "I have learned j2se. How can I switch to J2EE ?", "After reading thinking in Java, can I learn J2EE ?". So I came up with the idea of writing this article, hoping to help beginners avoid detours. It is also a summary of my years of learning Java.

It is necessary to discuss the concepts of j2se, j2se, and J2EE before you start. J2se, the Micro Edition of the Java 2 platform. It is mainly used for embedded Java, such as mobile phones and PDAs. J2se, Java 2 platform, Standard Edition, the JDK (Java Development Kit) we usually call here, is the basis of J2EE. J2EE, Java 2 platform, Enterprise
Edition is the so-called enterprise-level java. These are only divided by API level. In fact, Sun defines J2EE as: developing multi-layer enterprise-level application standards based on components. That is, to define a Java specification for different technologies, so that these different technologies can be combined to build strong enterprise-level applications on the Java platform. From this point of view, the concept of J2EE should cover j2se and j2se. For example, a typical J2EE application, an online store, supports Web-based order placement and mobile phone order placement. It is obvious that j2se and j2se must be used. Therefore, there is no such problem as switching from j2se to J2EE, but the latter has a wider scope.

Let's take a look at Sun's J2EE-related technologies.
1. Web Service technology
-Java API for XML Processing (JAXP)
-Java API for XML registries (jaxr)
-Java API for XML-based RPC (JAX-RPC)
-Soap with attachments API for Java (SAAJ)

2. Component Model Technology (Component Model Technologies)
-Java Servlet
-Assumerver pages
-Assumerver faces
-Enterprise JavaBeans
-Java Message Service
-J2EE Connector Architecture

3. Management Technologies)
-J2EE deployment Specification
-J2EE Management Specification
-J2EE client provisioning
-Java authorization contract for containers

4. Other Related Technologies (Other J2EE technologies)
-Java Data Objects (JDO)
-Java IDL and Java RMI-IIOP)
So many technologies will inevitably make beginners feel overwhelmed and discouraged. Even an experienced J2EE developer, I am familiar with J2EE-related technologies. However, as a developer of a common J2EE application, we only need to focus on learning some of the technologies. We only need to be aware of other technologies, one day, you need to know where to run and find the information. In my personal opinion, the following technologies must be mastered by J2EE application developers. Java Server Page, Java Servlet, Enterprise JavaBean, JDBC, transactions.
There are also XML-related technologies such as JAXP, Java Message Service, Java mail, JDO, and so on. Other management technologies, Connector Architecture, and so on are mainly for reference by the container provider's middleware provider. application developers do not need to care much about it. It is not too late to learn it when it is used.

Language Learning
The first is j2se basics. learning a new technology is nothing more than reading and practicing. A good reference book is especially important for beginners. currently, the Java books on the market can be said to be overwhelming, and the quality is also uneven, making beginners at a loss. so I recommend a few books first. currently, we generally recommend two books for basic java knowledge: <thinking in Java> and <core Java (TM) 2, volume I? Fundamentals>. Needless to say, the first book, the masterpiece of Bruce Eckel, jolt award-winning book, is comprehensive and covers almost all aspects of the Java language.
This book provides a wealth of examples to help you understand the learning content. in addition, the first part of the book introduces the basic oo books. I think it will be of great help to people who are new to oo. this book is open source. You can download the author's website. For those who are interested in reading Chinese versions, Hou Jie's Chinese version is a good choice. the disadvantage of this article may be that it is a little thick for beginners. This is why some people do not recommend this book as a beginner's learning book. the subsequent <core Java (TM) 2, volume I? Fundamentals>,
It is now the seventh edition. The popularity of this book can also be seen from the number of its publications. This book also provides a comprehensive and systematic description, basically, the Java language basics should be proven. the disadvantage is also too thick. It is a bit like a reference manual. The previous section has spent a lot of time talking about swing and Applet, which may not be very useful for beginners. there are also some basic books like <Java in a nutshell>.
After learning the basic language basics, don't forget that the most important and useful information is the JDK document. from the first day of your learning of Java, JDK documentation should be on hand. if you encounter a problem first, you should go to the Forum to ask a question instead of reading the JDK documentation. Do not continue to learn about it. Learn to check the JDK documentation first. it is no exaggeration to say that in our beginner's forum, 60% of the problems can be solved simply by checking the JDK documentation. the latest JDK documentationhttp: // (the latest version is j2se5 can't just say don't practice,
Download JDK from the same download page. after the installation is complete, I would like to mention that there is a under the installation environment (some JDK versions are SRC. jar), good things --- JDK source code. Someone always asks on the forum where JDK source code is downloaded. You say something is stored in your house and you can find it everywhere. with this problem, you need to compete with others on the Forum. Open the source code and check whether there are any questions. several of the most important command line tools are:
Javac: Compile the source file to the class file
Java: Run class
Jar: Packaging tool.
Javadoc: a tool for generating Java Doc.
For beginners of Java, I do not recommend using ide But directly using a text editor and then compiling and running it using command lines. this helps you understand the basic concepts of classpath and path. classpath is a confusing place for beginners. the current IDE is so clever that you can automatically generate the Java source code and compile the code with a name. maybe you have run your first hello World Program, and you do not know what Java and javac are used. as for actual project development, a proper IDE is very important. We will introduce some Java development tools later.

Basic J2EE and advanced Java language

After learning the language basics, You can naturally learn the actual J2EE technology. j2EE is complex, and EJB and Servlet are the core technologies that every J2EE developer needs to master. for servlet, I recommend <core Servlet and JSP 2 edition> and <more servlets and Java Server Pages>. The first is the servlet textbook recommended by Sun. the second is Amazon's best-selling Java book and five-star book. this book is a Chinese version of the Mechanical Industry Press called <Servlet
With the JSP authoritative guide>, I feel that the translation is still good, and the second version does not seem to have seen a Chinese version. both books fully and systematically introduce JSP and sevlet knowledge, from web server configuration, JSP, Servlet basic programming, tag Library (TAG Lib), filter, the event framework is well described. examples are also useful. there are two well-known EJB learning books: <Enterprise JavaBeans, 3nd edition> and <mastering Enterprise Java Beans Third Edition>, two authors Richard
Monson and Ed Roman are industry leaders. richard Monson is a member of the EJB standardization expert group. for me, the two books are difficult to distinguish between advantages and disadvantages, the second book has a benefit is can download for free.
In other words, we can't just say no, but it is a little troublesome to do J2EE exercises. The application server is indispensable. We 'd better prepare a lightweight database. The following is a brief introduction to these tools.
Web Server (servlet container.
Common application servers include,
WebLogic: Cntw.index.htm & fp =/content/products/Server
WebSphere: S_tact = 105agx28 & s_cmp = dlmain.
Tomcat, Jetty, and JBoss are both open source. Weblogic and WebSphere leaders in the J2EE server, which are expensive. However, developers can download free trial versions.
If you only want to learn servlet, we recommend that you use tomcat. It is a servlet officially designated by Sun. It is a reference implementation of JSP specifications .. the most important thing for beginners is that it is relatively simple to use, has a complete set of built-in documents, and has a large number of users. It is easy to get help on the Forum if you have any questions. JBoss is recommended for learning EJB, not only because it is open source, but mainly because the configuration is relatively simple and easy to use. for example, for the database connection, for the commonly used MySQL, Oracle, ms SQL and so on provide the sample config file, directly take some small changes to the deploy directory can be used
Datasource is deployed, and J2EE application deployment is simple. ear or. the war can be thrown to deploy. the only inconvenience is that it starts with jboss3.0 and its documentation starts to charge fees. however, some basic configurations are very easy to find on the Internet. After all, they are too popular. webLogic is easy to use, but it is much larger than JBoss. It makes some common configuration work very simple through a powerful management interface. compared with JBoss, JBoss has too many documents, which is a bit arrogant, for example, deploying one. the ear file, which is usually automatically deploy when we directly drop the applications directory under the domain,
However, it is a long story to read. It is easy to scare beginners and think that this is a profound learning. as for WebSphere, it is not recommended for beginners. It is more difficult to use than the first two servers, and the memory consumption is rampant. however, this guy is doing well in the enterprise market. After all, he was born in a great place like IBM.
Database, the current common PostgreSQL, MySQL, Oracle, ms SQL, DB2 and so on. the first two are open-source databases, and the last few are basically monopolized by most of the database markets. I recommend MySQL for beginners to do EJB and JDBC exercises. The reason is very simple. Open-source software does not require money. It is easy to use and has a wide range of documents. postgreSQL can also be considered, but domestic users are far less convenient than MySQL, so it is easier to ask questions on the forum,
Http:// As for those more heavyweight back of the database, in order to do exercises do not have to consider, I can not afford this money.

After learning the specific technologies of J2EE, it is not a problem to perform basic J2EE development at this time. now you should consider improving your code quality. here I strongly recommend Martin Fowler's <refactoring: improving the design of existing code>. This book is not a very practical book, the author teaches you how to improve the quality of the Code, tell you what is the bad smell of the code from the specific code, and how to remove these bad smell. many book reviews say so. This book is helpful to beginners and intermediate readers. at least
The coding quality has been greatly improved for a few programmers who have recently learned programming. of course, the refactoring concept is not only applicable to Java, but also to all oo languages. the concept of refactoring is so deeply rooted that almost all popular ide tools today support refactoring. here, I would like to recommend another <strong tive Java>. programmers from C ++ know the role of <strong tive C ++> in the C ++ field. So far, there are still such interesting stories. c ++ programmers are divided into two types, one is read <strong tive C ++>, and the other is not read c ++.
Although the impact of this <strong tive Java> On the Java field may not be so great, it is of great guiding value to Java programmers. the author is Sun's Joshua Bloch, designer of Java Collection framework. from the perspective of the JDK designer, the author will introduce you to his best practice. Instead of doing so, he will not point out some of the API design defects in JDK. james Gosling, the father of the Java language, wrote the preface for this. "I sure wish I had this
Book ten years ago. some might think that I don't need any Java books, but I need this one ". this book will make you feel that you still have a lot of questions about Java. for example, we think the equals method of an object is very simple. Maybe you will reload this method for your new class every day, however, you have paid attention to the "self-inverse", "symmetric", and "pass" factors that must be taken into account during overload. Are you also careful to reload the hashcode method? If not, you are advised to read this book.
After reading this book, you will feel closer to Java. both of the above books have been published in the Chinese version, and the later <strong tive Java> has two versions of the Chinese version. The first translation is a little short, later, the mechanical industry press commissioned Mr. Pan aimin to re-translate it. the same book has been translated twice in a row in the same publishing house. It also shows that the Chinese publishing industry still attaches great importance to this book.
At this stage, while reading a book, you can combine the source code of some excellent open-source projects. the Code style and comments of these open-source projects are worth learning. it's too lazy. Don't forget to have a JDK source code on hand. in fact, you don't have to look for source code. In actual J2EE project development, some excellent open-source projects are basically used. the framework may use spring, struts, and log mechanisms. Basically, jarkartacommons log or log4j will be used in unit tests. In combination with the project, read some of the source code, it can improve itself and help the project, so it may be appreciated by PM.
How happy is it. haha, It's a little far away. after the beginner's time, we should learn how to find a suitable Java book. after dozens of years, today's Java technology has become so complex that I believe that even a person who has spent all his life can never learn all the relevant Java technologies, what's more, new technologies are coming soon. Who will know three years ago that struts will become the de facto industrial standard of Web frameworks. 2 years ago, who would know that hibernate will be dominant today. since we can't expect to learn all aspects of Java at one time, we can only learn what technology is needed in practice. if you can choose a good reference book, you can get twice the result with half the effort.
Effect. so I think it is worthwhile to spend some time on choosing books. Otherwise, you will only spend more time later. next I will talk about some of my experiences in choosing books, which is not necessarily correct. first, let's take a look at the authors. The authors of the books mentioned above are all famous in the industry. It is generally impossible to choose their books. if you read more books, you will naturally have a list in your mind, which authors are trustworthy. 2. Publishers and computer books, oreilly and Addison-Wesley are well-recognized publishers. oreilly's <XXXX in action> series is a good choice for currently popular Java technologies.
In addition, I will also go to the Amazon website ( book reviews, generally less than 3 star books I will not consider. there is also a good place for book reviews at theserverside, the book reviews here are interesting and often have heated debates. Some celebrities often speak. I would like to recommend to all Java learners. If my favorites can only store two websites, I will select Java. sun and theserverside. here you can learn about the latest Java developments, learn the first-hand Java materials, and see the heated debate among Java experts (there are many industry leaders.
At this stage, the basic skills of Java developer should be well developed, and I will continue to learn it later. before the end of this section, I will introduce oreilly's <Java threads, Second Edition>, because I think multi-thread programming is a basic java skill, everyone who wants to learn java well should master it well.


At this stage, we should learn from the software architecture and framework layers. as an object-oriented Bible <Design Patterns>, this book has to be recommended. needless to say, this role in the Object-Oriented field belongs to the Godfather level. no matter what OO language you are learning, No matter what language you are using now. net or J2EE development. This book is a must-read on your way to the advanced level. <core J2EE patterns> is designed for J2EE. Senior designers of Sun Java center describe the mode of key J2EE technologies. best Practices, design strategies and proven solutions.
This book is worth reading for everyone who wants to become a J2EE architect or designer. when learning the design mode, it is recommended to look at the actual source code, such as looking at the JUnit source code, you can see a lot of elegant Implementation of the design mode, one of the authors, Erich Gamma, is the author of <Design Patterns>. as for the J2EE design mode, Sun also opened up a dedicated space, which has a discussion of the common mode and provides a detailed source code example. as Grady booch said, the model provides a general solution to common problems,
The Exploitation Mode is equivalent to having a strong team of experts. if you have not studied, start now. in addition, for the object-oriented methodology, the idea of extreme programming should also have a certain understanding of /. rod Johnson's <expert one-on-one J2EE design and development (programmer to programmer)> is also very valuable for the specific implementation of the J2EE project, with the rich practical experience of the author, this book shows us how to build a J2EE application with the simplest possible solution. The author first puts forward this point of view,
In many cases, there is no need to use ejbs for J2EE applications. For the majority of J2EE developers who must call ejbs, it is also a bit cool. of course, as a member of the servlet and JDO expert groups, this is not what the author believes. today, the Spring framework popular in the Java World originated from this book, and concepts such as IOC and AOP are even more widely spoken by Java developers. finally, as an in-depth study of Java, it is also necessary to read the specification of Java technology. write it here for now

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: 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.