【问题标题】:How to detect whether tomcat and ant are installed on linux machine如何检测linux机器上是否安装了tomcat和ant
【发布时间】:2013-02-21 06:30:03
【问题描述】:

我正在尝试在我的 linux 机器上安装 TomcatAnt,但在安装它们之前我只需要检查它们是否已经安装。

关于 tomcat

我用谷歌搜索了很多,并在我的机器上的以下目录中搜索了 tomcat

/usr/local/, /opt/, /usr/share/

但是我在上面的任何路径中都没有找到tomcat文件夹,是否表明tomcat没有安装?原来如此

1. what is the path to `look/find` exactly to know/check whether tomcat is installed or not in 
   all linux machines
2. what will be the path the tomcat will be installed exactly after installation
3. How to find the version of tomcat on any linux machine (if tomcat already installed) 
4. Whether there are any commands to look for both whether `tomcat` installed and `ant` 
   installed

关于蚂蚁

我用谷歌搜索并得到了以下命令,因此我在执行后得到了以下结果 它

sh-4.2$ ant -v

结果

sh-4.2$ ant -v
Apache Ant(TM) version 1.8.2 compiled on November 21 2011
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed

其实

1. Does the above result mean that `Ant` is installed ? or not ?
2. what is the path to `look/find` exactly to know/check whether ant is installed or not in 
   all linux machines
3. what will be the path the `ant` will be installed exactly after installation
4. How to find the version of `Ant` on any linux machine (if Ant already installed) 

【问题讨论】:

    标签: linux apache tomcat ant version


    【解决方案1】:

    一般情况下,你可以检查它们是否在 $PATH 上,如果不在 $PATH 上,则安装一个。

    对于蚂蚁:

    ant -v 代表详细,ant -version 打印出它的版本。

       -help, -h
              print help on the command line options
    
       -projecthelp, -p
              gives information on possible targets for this project
    
       -version
              prints the version number and then exits ant
    
       -quiet, -q
              be extra quiet
    
       -verbose, -v
              be extra verbose
    
       -debug, -d
              print debugging information
    
       -emacs, -e
              produce logging information without adornments
    
       -logfile <file>, -l <file>
              use the given file to output log to
    
       -logger <classname>
              the class which is to perform logging
    
       -listener <classname>
              add an instance of the given class as a project listener
    
       -noinput
              do not allow interactive input
    
       -buildfile <file>, -file <file>, -f <file>
              use  the  given buildfile instead of the default build.xml file.
              This is the ant equivalent of Makefile
    
       -D<property>=<value>
              use value for the given property
    
       -keep-going, -k
              execute all targets that do not depend on failed target(s)
    
       -propertyfile <file>
              load all properties from file with -D properties  taking  prece-
              dence
    
       -inputhandler <class>
              the class which will handle input requests
    
       -find <file>, -s <file>
              (s)earch  for  buildfile  towards the root of the filesystem and
              use it
    
       -nice number
              A niceness value for the main thread: 1 (lowest)  to  10  (high-
              est); 5 is the default
    
       -nouserlib
              Run ant without using the jar files from ${user.home}/.ant/lib
    
       -noclasspath
              Run ant without using CLASSPATH
    
       -autoproxy
              Java 1.5+ : use the OS proxies
    
       -main <class>
              override ant's normal entry point
    

    对于tomcat:

    如果 tomcat/bin 在 $PATH 变量上,version.sh 将打印出版本。

    【讨论】:

    • 对于 Ant :可以找到 ant 的版本,但是 ant 将安装在 linux 上的路径/路径是什么?
    • 对于 tomcat:这里的 $PATH 变量是什么?如何找到它?我在系统上的任何地方都找不到任何 tomcat 文件夹?安装tomcat的实际路径在哪里?
    • 因为首先我会检查 tomcat 是否在那个路径中,然后我会运行 version.sh ......因为在不知道 tomcat 将被定位/安装在哪里之前我们怎么能进去到那个文件夹并执行 version.sh ?
    • 使用“which ant”来查找蚂蚁的位置。您可以在不使用 /usr/../../ant 的情况下使用 ant,因为它位于 $PATH 变量中。使用 'echo $PATH' 看看。
    • 如果它不在 $PATH 变量上。然后你就可以安装它了。它几乎没有副作用。
    【解决方案2】:

    对于 linux ubuntu 18.04:

    Go to terminal and command:$ sudo systemctl status tomcat
    

    此命令还显示是否运行 tomcat(如果已安装)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-20
      • 1970-01-01
      • 2012-09-22
      • 1970-01-01
      • 2010-11-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多