• 由tomcat启动想到的


     

    1.batch:批处理文件,表示一批
    2.profile:轮廓
    3.用户变量和系统变量的关系是什么?

        答:点击“我的电脑→属性→高级”标签的“环境变量”按钮,出现“环境变量”对话框,如果当前是以Administrator登录系统的用户,对话框的上面为Administrator的用户变量,对话框的下面为系统变量(即相当于系统中所有用户的用户变量)。
        有的时候我们会看到在用户变量和系统变量中都存在某一个环境变量,比如path,那么path的值到底是用户变量中的值还是系统变量中的值,或者两者都不是呢?答案是两者都不是。path变量的值是用户变量中的值与系统变量中的值的叠加。
    4.改变环境变量和环境变量中的值应该注意什么?

        答:环境变量和环境变量的值不要含有空格,也不要用中文,切记!
    5.如何命令行下修改环境变量?

        答:在命令行模式下输入set即可查看环境变量。比如要查看path环境变量的设置,可以输入“set path”。要创建一个环境变量,比如要创建一个名为csc,值为“c:”的环境变量,可以输入“set csc=c:”命令。而要删除 一个环境变量,比如要删除cse环境变量,则可输入 “set csc=”命令(注意=后面不能有空格)。如何更改一个环境变量的设置呢?更改环境变量有两种情况:一是追加方式,即在不改变环境变量现有设置的情况下,增 加变量的值,比如要给环境变量增加一个值为“D:”的设置,可以输入“set csc=%path%;D:”。另一种是完全修改方式,对于这种方式,我们可以采用直接创建一个环境变量的方法来实现。

        注意这种方式只对当前运行窗口有效,关闭窗口后,设置也就不起作用了。
    6.设置默认浏览器?

        答:禁止光盘自动运行也在这,问题源于平时积累。

         12

         34

    7.目录:directory,所以dir就是目录,cd就是CURRENT_DIR。

    8.tomcat如何启动的(启动catalina之前就是startup.bat)?

        答:首先我们看一下startup.bat的内容是什么:由于没有bat语言,笔者按C/C++体系添加代码。

    @echo off
    rem Licensed to the Apache Software Foundation (ASF) under one or more
    rem contributor license agreements.  See the NOTICE file distributed with
    rem this work for additional information regarding copyright ownership.
    rem The ASF licenses this file to You under the Apache License, Version 2.0
    rem (the "License"); you may not use this file except in compliance with
    rem the License.  You may obtain a copy of the License at
    rem
    rem     http://www.apache.org/licenses/LICENSE-2.0
    rem
    rem Unless required by applicable law or agreed to in writing, software
    rem distributed under the License is distributed on an "AS IS" BASIS,
    rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    rem See the License for the specific language governing permissions and
    rem limitations under the License.
    
    if "%OS%" == "Windows_NT" setlocal
    rem ---------------------------------------------------------------------------
    rem Start script for the CATALINA Server
    rem
    rem $Id: startup.bat 895392 2010-01-03 14:02:31Z kkolinko $
    rem ---------------------------------------------------------------------------
    
    rem Guess CATALINA_HOME if not defined
    set "CURRENT_DIR=%cd%"
    if not "%CATALINA_HOME%" == "" goto gotHome
    set "CATALINA_HOME=%CURRENT_DIR%"
    if exist "%CATALINA_HOME%incatalina.bat" goto okHome
    cd ..
    set "CATALINA_HOME=%cd%"
    cd "%CURRENT_DIR%"
    :gotHome
    if exist "%CATALINA_HOME%incatalina.bat" goto okHome
    echo The CATALINA_HOME environment variable is not defined correctly
    echo This environment variable is needed to run this program
    goto end
    :okHome
    
    set "EXECUTABLE=%CATALINA_HOME%incatalina.bat"
    
    rem Check that target executable exists
    if exist "%EXECUTABLE%" goto okExec
    echo Cannot find "%EXECUTABLE%"
    echo This file is needed to run this program
    goto end
    :okExec
    
    rem Get remaining unshifted command line arguments and save them in the
    set CMD_LINE_ARGS=
    :setArgs
    if ""%1""=="""" goto doneSetArgs
    set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
    shift
    goto setArgs
    :doneSetArgs
    
    call "%EXECUTABLE%" start %CMD_LINE_ARGS%
    
    :end 
          先说echo off就是说不显示bat文件的内容只显示执行结果,加上@后连echo off也不显示了。下面看17行
                   if "%OS%" == "Windows_NT" setlocal
            image
        双%% 是从环境变量里读取信息,下来需要看看setlocal这个命令做了些什么操作,下面看一下
    在microsoft网站上对于setlocal的讲解:
          Starts localization of environment variables in a batch file. Localization continues until a matching endlocal command is encountered
     or the end of the batch file is reached.

        下面是某大牛的翻译,笔者感觉相当到位:在批处理文件中环境变量的本地化操作。意思就是在setlocal命令执行以后,对于环境变量所做的修改只是对于本批处理文件有影响,这个影响直到对应的endlocal命令,或者批处理文件结尾处时消除。

        再看第25行,

            set "CURRENT_DIR=%cd%"

        就是设置成当前目录,也就是tomcat安装路径,这其实就是CATALINA_HOME,继续可以看出设置CATALINA_HOME这个变量只是为了加快启动速度(个人观点)。

        下面继续对路径校检了两次。 
    10.如何调试启动tomcat?

        答:不必修改web.xml,直接在tomcat目录里,如下图:

          33HB%NY49@]NG_}YPVT]I7J
    11.sh文件就是标注的B shell 。

  • 相关阅读:
    学生管理系统后感
    数据库是什么鬼,怎么连接,怎么搞
    nIce 不看会后悔的o!
    那些年披巾斩浪的数据库
    day82
    day81
    day80
    day79
    day78
    day77
  • 原文地址:https://www.cnblogs.com/hxsyl/p/3623642.html
Copyright © 2020-2023  润新知