Java has always had its best benefits to choose it, but these casually overlooks or visit the answer on the Internet. In this article, the author writes some of the body of Java to learn Java, and the scholars are given a reference.
I am studying in the process of learning Java to learn from the following aspects:
1. Always remind yourself Java is an OOP language tool, not just coding, only in this way will grasp and use Java.
2. In the process of learning, it is best to understand the underlying mechanism of Java instead of staying in the surface, not the example of the copy of the book. It should be noted that even if there is a simple example, there must be patience, debug, and change.
3. Be sure to do it during the process of learning, write code, not to hold a book to see it. Many things and experiences must do their own to really belong to themselves, it is best to participate in some actual projects.
4. After learning a certain stage, what you have begun to do what you have learned. At this time, you should start learning some more, more complicated knowledge, such as the construction of the J2EE platform, EJB development, etc. For this part, I suggest that it is best to find a thin book to understand a matter, there is a general understanding in my heart, and a preliminary master of more technical terms. I think this stage look at "J2EE technology practice" is very good, it allows you to understand the various techniques and frames included in J2EE, while providing a lot of practical examples to deepen the overall understanding of J2EE.
Learning Java's interest and determination has played a key role. After having the above foundation, I started learning Java step by step.
Java Environment Building (Java Environment -Jsp-MySQL-Tomcat)
To run the Java program, you must install JDK. JDK is the core of the entire Java, including Java compiler, JVM, a large number of Java tools, and Java foundation APIs.
The JDK1.5 version can be downloaded from http://java.sun.com/j2se/1.5.0/download.jsp.
Unzip installation. Then, the environment is set. JDK1.5 download URL http://192.18.97.238/ECom/EComTicketServlet/BEGINB0896C8AB4D1F89812458DB1E451448D/-2147483648/651374223/1/531770/531614/651374223/2ts /westCoastFSEND/jdk-1.5.0-oth-JPR/jdk-1.5. 0-other-jpr: 1 / jdk-1_5_0-windows-i586.exe
http://java.sun.com/j2se/1.5.0/download.jsp
JCREATOR Pro 2.5 (with registration) http://www.java-cn.net/javatools/tools/jcpro250.zip
JDK1.5 JCREATOR Pro 2.5 Beginner's best compiler.
1, JDK's basic configuration:
Win2000, XP right-click "My Computer", select "Properties", select "Advanced", set "Environment Variable" Path Set to: C: / Program Files / Java / JDK1.5.0 (JDK Path) / bin;
Set java_home as: c: / program files / java / jdk1.5.0; // jdk path
ClassPath = C: / Program Files / Java / JDK1.5.0 (JDK Actual Path) / lib; (If you already have PATH and ClassPath, please do not delete the original value, add it directly to the back.)
Win98: Win9X, you need to modify the PATH and ClassPath variables of the autoexec.bat file under the root of the system:
SET PATH =% PATH%; C: / JDK 1.5 / bin; set classpath = .; c: / jdk 1.5 / lib; Re-executing autoexec.bat after the parking is described in the JDK's important commands:
◆ Java execution tool is a command to start JVM (virtual machine) and execute the class (Byte code) file;
◆ Javac compiler, generates a .class file by .class file;
◆ JAR JAVA compressed package tool;
◆ Javadoc document generator.
Finally, JDK Documentation, this is the JDK online help document, is the most useful and most important learning reference document, should look more.
2, Tomcat configuration:
(1) Set an environment variable: tomcat_home = f: / tomcatcatalina_home = f: / tomcatjava_home = C: / program files (the installation path, here is the default path) /Java/JDK1.5.0; Set ClassPath = f: / Tomcat / lib If you want to boot Tomcat with a command line, set PATH = "f: / tomcat"
(2) Enter http:// localhost: 8080 or http://127.080 or http://127.080 or http://127.0.0.0.1:8080 If you can see Tomcat Version 4.0, Tomcat is successful.
(3) Tomcat's configuration files are in its installation path / conf directory, the primary configuration file is Server.xml: Change the server listening port: Find , Vaule property value It is the port number and can be changed.
DocBase = "f: / myexample" debug = "0" RELOADABLE = "true"> context> The above example adds a service: Path indicates the URL path of the service, and DOCBASE represents the path to the hard disk. Debug indicates whether it is allowed to debug, and the reloadable indicates whether the servlet is automatically reloaded. Use mysql database: After downloading MySQL JDBC driver, put mm.mysql-2.0.4-bin.jar (some version is mysql-connector-java-3.0.9-stable-bin.jar) under Tomcat installation path Lib Directory. The JSP program of the test is as follows:
<% // Close the result set object sqlrst.close ();
// Close the statement object sqlstmt.close ();
// Turn off the database connection SQLCONN.CLOSE ();%> 3, install Apache Click File Apache_2.0.0.0.0.0.0.0.0.0.0.0.0.0.msi for installation, Target Directory Selection: g: / Amicrasy / MyWeb / ... (Several The services are installed in this directory, ... refers to the directory name of the corresponding service, the same below). Enter G: / Amicrasy / MyWeb / Apache Group / Apache2 / conf / httpd.conf Modify httpd.conf ---------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- Start Monitor Apache Servers, this time Apache is installed .
4, MySQL installation Opens the setup.exe of the mysql-4.0.12-win directory for installation, target directory selection: g: / Amicrasy / MyWeb / .... After the installation is complete, restart your computer, start WinMysqladmin, you can start MySQL at this time. After starting mySQL, let's make a while, try using mysql: start -> Run -> "cmd", enter the command: g: cd Amicrasy / MyWebases; Use mysql; show tabales SELECT Host, User, Password from User Select User (); CREATE DATABASE MyData; DROP DATABASE MyData; Quit; Exit We can simply operate Mysql through these.
4, PHP Install the PHP-4.3.2-Win32 directory to copy to the corresponding directory G: / Amicrasy / MyWeb / ..., and reform the directory name PHP. Next: Enter G: / AMICRASY / MyWeb / PHP, change the file name php.ini-dist of PHP.INI, open php.ini, modify parameters: ------------ ---------------------------- session.save_path c: / windows / temp ------------- --------------------------- Note that C: / Windows / Temp, the Windows directory is different depending on the installed operating system, such as Win2000 this The directory is WinNT, this Temp directory must exist, in general, this setting is critical, because PHP is installed in Windows, and session is not allowed to have a problem. Then copy php.ini to C: / Windows (Windows 9X / ME / XP) C: / WinNT (Windows NT / 2000). Finally, PHP4TS.DLL is copied to C: / Windows / System (for Windows 9X / ME) C: / WINDOWS NT / 2000) C: / Windows / System32 (for Windows XP).
To this PHP installation configuration is basically completed, then you need to configure Apache so that it can use PHP. Enter G: / Amicrasy / MyWeb / Apache Group / Apache2 / conf / httpd.conf Modify httpd.conf to add the following code: --------------------- ----------------- loadModule PHP4_Module "g: /am ident/myweb/php/sapi/php4apache2.dll" AddType Application / X-httpd-php .php ----- ----------------------------------- // pay attention to the above G: / Amicrasy / MyWeb / PHP / SAPI / php4apache2.dll is different depending on the previously replicated PHP directory. Here, our configuration is completely completed, then we test: write test file info.php (copy to directory g: / Amicrasy / myweb / apache group / apache2 / htdocs / below), file content: (on a line) - -------------------------------------------------- ----------------------------- Restart Apache, start IE, address bar input http://localhost/info.php, You can see the page. About Apache and PHP installation configurations You can view the following two PHP Official Website Installation Guide: Link 1, Link 2. Http://www.php.net/manual/en/install.apache2.php#install.apache2.windows http://www.php.net/manual/en/install.windows.php
Let's download some PHP MySQL source code programs from the website, then try it, I downloaded a discuz! 2.0 forum tried it, completed successfully, these procedures were very online, just configure it first. A profile, enter the MySQL account, password, and other do not set up, then run install.php, which includes databases, tables will help you build, a php mysql forum is completed, then download an article in the area Programs and message programs, modify the interface, and a good personal website is coming out. what. The front introduced Apache MySQL PHP installation in the Windows system, and then we also let Apache can run JSP.
Start writing your own code
Now there is an environment, you should write a simple code for testing. Start from the classic "Hello Word".
1. First write a code with the editor (I use Linux VI):
[stone @ Coremsg Work] $ VI Hello.java public class hello {public static void main (string [] argc) {system.out.println ("Hello Word!");}}
2. Compile:
[stone @ Coremsg Work] $ javac hello.java
3. carried out:
[stone @ Coremsg Work] $ JAVA Hello Hello Word!
Success! This is my first Java program. Since then, I know that I have begun to walk into the world of Java, and I will rely on my own efforts. In this process, the author thinks there is a need to pay attention. Learn a new language, the reference book is inseparable. My suggestion is to start finding a shorter entry book to learn the simplest, most basic things, including learning Java grammar. At the same time, it should be more debugged for a simplest procedure. Think about what results will occur if you change? Why do you have to write? Think more about these problems and then do it, you will make you more harvest. This is useful to think repeatedly. In addition, at this stage, you should also look at JDK online help, try to grasp the Java basic class library API provided by JDK.
After a certain basis, you can write some simple programs, you can start watching "Thinking In Java" book. It introduces the syntax of Java, object-oriented features, core class libraries, etc. Through this level of learning can deepen the application of Java's understanding and underlying principle, while you can fully understand the entire system of Java. At this stage, you should focus on learning the characteristics of Java's object-oriented programming languages, such as inheritance, constructors, abstraction, interface, polymorphism, overload, coverage, Java's exception handling mechanism, etc., to have the above concept Very clear understanding. The purpose of doing this is to let yourself apply these technologies into practice for reasonable programming (for example, you will consider a class to design, etc.). This requires the application and study in a large number of practices. This is also the suggestion that many friends gave me.
Learn more
If you want to use Java to complete a stronger task of various functions, then learn more other than language.
1.java web programming
For Java Web programming, you should and must be familiar with and master the HTTP protocol, you can refer to Stevens' TCP / IP Details "Volume 3. Java servlet technology provides the ability to generate dynamic web page content, which is one of the most basic features in your Java project, so you must learn. Learning through this phase should master the WEB programming of servlet / JSP.
2. J2EE's learning
J2EE contains too much technology. If you want to sit next to the table, you can learn a lot of books to learn, the effect is not big. I suggest that when I started this phase, I can do it in the following steps, and the general thinking is "overall grasp, all breaks".
◆ Understand the meaning of technical terms in J2EE.
My feelings are a lot of technologies involved in the J2EE standard. If I started to learn, it is unrealistic, and it is no effect. My suggestion is that there is a probably understanding of the technology, such as EJB, JavaIDL, JTA, etc. Maybe you don't know how to write an EJB, but you have to know what is ejb, what can be done, after having such a concept, then go to a destination to learn it is much faster. I have to repeat anything - I have to do it in practice.
◆ Understand the design pattern in J2EE, so you can help you make a whole grasp of J2EE.
The MVC development model proves to be one of the effective processing methods. It can separate data access and data performance. You can develop a scalable, easy-to-extend controller to maintain the entire process. Through this level of learning, when you face a project, you should first grasp the design of its overall architecture, and how to decide which techniques in the J2EE standard.
◆ Understand some typical cases of J2EE platforms to deepen the concept and understanding of this technology.
Usually pay more attention to this, familiar with some typical cases, and analyze why it takes that time? What kind of purpose can you achieve? Then contact if the item around you can be used as a reference.