Learning Java Web: configuring tomcat & programming tools

The growth path of Java Web

1, The first step in learning Java Web: configuring Tomcat & programming tools
2, Learning JavaWeb:"Hallo My First JavaWeb"

Urgent update

preface

Learn JavaWeb, a good computer (I use Windows), a lovely Tomcat, a strong idea (community version), and a browser that can see "CSDN". Take them with us and set sail I've started learning java web. No one can't even configure jdk. Forget it. Let's explain it in a few words. Let's see if you're right?

1, Configure JDK environment variables

  1. Step 1: Download javase17 < -- why not use the new one -- > it is recommended to download the installation free version, that is, the compressed file
  2. Step 2: unzip the downloaded compressed package to a place you like < -- try not to put it on Disk C -- >
  3. Step 3: open "environment variable" < -- if you don't know where it is, please click the search box at the bottom, enter the word "environment variable", and open the search resu lt s, as shown in the figure -- >


Click environment variables

  1. Create a new variable in the system variable - > the variable name is < Java_ Home > the variable value is the Java path (pointing to the upper level of the / bin directory, as shown in the figure). Select the path and click OK

  2. Find a variable named path in the system variable and add% Java at the end_ HOME%\bin\

  3. Successful verification: old method CMD > java - version

2, Tomcat

An integral part of running Java Web

1. Configure Tomcat

  1. install tomcat10 Select and click zip

  2. Configure tomcat: Reference Configure jdk Step 2 and below in (replace JAVA_HOME with CATALINA_HOME);

  3. Run tomcat: find the startup.bat file in the bin directory, double-click to run it, and a command box will appear
    If JAVA HOME & Catalina home is configured correctly, 99% of the command box can appear normally

  4. Enter the server:

    1. Enter in the browser http://localhost:8080/ Enter tomcat homepage
    2. The appearance of this lovely tiger interface shows that it has been successful!

#Garbled code problem #8080 port problem #Go straight to the next section

2. First run FAQs

< -- garbled -- >

Find the logging.properties file in the conf folder. Change the fifth utf-8 in the following code to gbk

1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
1catalina.org.apache.juli.AsyncFileHandler.maxDays = 90
1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8

2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
2localhost.org.apache.juli.AsyncFileHandler.maxDays = 90
2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8

3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
3manager.org.apache.juli.AsyncFileHandler.maxDays = 90
3manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8

4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
4host-manager.org.apache.juli.AsyncFileHandler.maxDays = 90
4host-manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
#java.util.logging.ConsoleHandler.encoding = UTF-8 / / to be modified
java.util.logging.ConsoleHandler.encoding = GBK//After modification

< -- 8080 port occupied -- >

  • A tomcat has been opened. Close it to eliminate occupation
  • The opened tomcat cannot be found. Try closing tomcat using the bin/shutdown.bat file
  • The problem is not that tomcat has been opened, and I don't know what program is occupying it
    (1) Restart the computer < -- a big man said that restarting the computer can solve 80% of the system problems -- >
    (2) Still occupied after restart (very difficult to meet)

Borrow other people's articles here Solve port occupation

3, Programming tools

There are numerous and dazzling programming tools on the market. Some tools are very intelligent and some tools are very uncomfortable. Here are two recommended tools

1. Idea (Community Edition)

  • download idea Community Edition
  • It is recommended to download idea in exe file format;
  • The installation version can easily open some files with the right button
  • The reason for using the Community Edition is
    • 1. Free,
    • 2. Stable performance,
    • 3. The most important thing is that he doesn't have too much support for web programming
  • Most of a Java web project is written using java files, so the community version is enough
  • The third point is the main reason why I chose him. Because we are for the purpose of learning, not to submit a project quickly. Using the community version can let us have a clearer understanding of the internal structure of Javaweb and the connection mode of various parts (even if it does not support jsp el css js...)
  • Alternative ways of writing these documents will be proposed in later articles. A seemingly complex but thorough way

2. Browser

Compared with various built-in browsers, the real browser is the king,

  • List mainstream browsers

    • edge
    • Firefox
    • google
  • The ultimate goal of using browsers is to use their F12 developer model

summary

The above is the operations required for the first step of learning java web and the tools that need to be prepared. In the next article Learning JavaWeb:"Hallo My First JavaWeb" Let's move on

Keywords: Java Tomcat intellij-idea

Added by vapokerpro on Wed, 01 Dec 2021 12:38:36 +0200