报错:

Cannot find ./catalina.sh
The file is absent or does not have execute permission
This file is needed to run this program

原因:

没有给bin目录下的文件授权可执行权限:

解决方法:

chmod +x bin/*.sh

报错Neither the JAVA_HOME nor the JRE_HOME environment variable is defined:

解决方法如下:

tomcat启动脚本文件: startup.sh,     startup.sh会加载 catalina.sh ,    catalina.sh会加载setclasspath.sh

Linux:  export JAVA_HOME=绝对路径       Windows:   set

可以直接添加到第二行:

#!/bin/sh
export JAVA_HOME=/usr/local/java1.8
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at

成功

[root@hadoop1 apache-tomcat-8.0.43]# sudo  bin/startup.sh
/home/report/apache-tomcat-8.0.43/bin/catalina.sh:行143: -Xmx1024m: 未找到命令
Using CATALINA_BASE: /home/report/apache-tomcat-8.0.43
Using CATALINA_HOME: /home/report/apache-tomcat-8.0.43
Using CATALINA_TMPDIR: /home/report/apache-tomcat-8.0.43/temp
Using JRE_HOME: /home/jdk-10.0.1
Using CLASSPATH: /home/report/apache-tomcat-8.0.43/bin/bootstrap.jar:/home/report/apache-tomcat-8.0.43/bin/tomcat-juli.jar
Tomcat started.

以上是在catalina.sh文件中添加的。依然存在问题,就是关闭指令运行报错 shutdown.sh

[root@hadoop1 apache-tomcat-8.0.43]# sudo bin/shutdown.sh

/home/report/apache-tomcat-8.0.43/bin/catalina.sh:行143: -Xmx1024m: 未找到命令
Using CATALINA_BASE: /home/report/apache-tomcat-8.0.43
Using CATALINA_HOME: /home/report/apache-tomcat-8.0.43
Using CATALINA_TMPDIR: /home/report/apache-tomcat-8.0.43/temp
Using JRE_HOME: /home/jdk-10.0.1
Using CLASSPATH: /home/report/apache-tomcat-8.0.43/bin/bootstrap.jar:/home/report/apache-tomcat-8.0.43/bin/tomcat-juli.jar

./catalina.sh: 1: eval: usrjjdk-10.0.1re/bin/java: not found

 

还是显示找不到,而且路径 usrjdk-10.0.1jre莫名奇妙少了 '/'  。

解决方法:

把刚刚修改的 export JAVA_HOME环境变量改写到 setclasspath.sh里面,把原先的 catalina.sh export那个删除掉

成功解决:

[root@hadoop1 apache-tomcat-8.0.43]# sudo  bin/shutdown.sh
/home/report/apache-tomcat-8.0.43/bin/catalina.sh:行143: -Xmx1024m: 未找到命令
Using CATALINA_BASE: /home/report/apache-tomcat-8.0.43
Using CATALINA_HOME: /home/report/apache-tomcat-8.0.43
Using CATALINA_TMPDIR: /home/report/apache-tomcat-8.0.43/temp
Using JRE_HOME: /home/jdk-10.0.1
Using CLASSPATH: /home/report/apache-tomcat-8.0.43/bin/bootstrap.jar:/home/report/apache-tomcat-8.0.43/bin/tomcat-juli.jar

sudo 启动tomcat报错没有java环境的更多相关文章

  1. Linux系统下启动tomcat报错【java.util.prefs.BackingStoreException: Couldn't get file lock】的解决方法

    Linux环境下,启动tomcat报出如题的警告信息,虽然对系统正常使用没有多大影响,但是会导致tomcat的日志垃圾信息很多,而且看起来很不爽... 具体的警告信息如下: Jan , :: PM j ...

  2. IDEA启动tomcat报错:java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext、ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component

    先看错误日志: -May- ::.M26 -May- :: :: UTC -May- ::29.845 信息 [main] org.apache.catalina.startup.VersionLog ...

  3. maven 项目启动tomcat报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    maven项目启动tomcat报错: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...

  4. eclipse使用maven,启动工程tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.Contex

    maven是个不错的管理jar包工具,但是我们在eclipse使用maven时,总是遇上这样那样的问题,比如今天,我编译工程,启动过后,tomcat报错:java.lang.ClassNotFound ...

  5. 【转】Eclipse下启动tomcat报错:/bin/bootstrap.jar which is referenced by the classpath, does not exist.

    转载地址:http://blog.csdn.net/jnqqls/article/details/8946964 1.错误: 在Eclipse下启动tomcat的时候,报错为:Eclipse下启动to ...

  6. IDEA启动Tomcat报错1099 is already in use

    IDEA中启动Tomcat报错,Error running Tomcat7.0.52: Address localhost:1099 is already in use 或者是 java.rmi.se ...

  7. tomcat报错:java.net.SocketException: Permission denied["http-nio-80"]

    tomcat报错:java.net.SocketException: Permission denied["http-nio-80"] 问题:使用非root账户tomcat启动to ...

  8. mysql-connector-java升级到6.0以后启动tomcat报错

    mysql-connector-java升级到6.0以后启动tomcat报错 java.sql.SQLException: The server time zone value '�й���׼ʱ��' ...

  9. IDEA启动Tomcat报错

    Maven编译成功, 可是启动Tomcat报错: Application Server was not connected before run configuration stop, reason: ...

随机推荐

  1. C#学习笔记-模板方法模式

    题目:同学摘抄老师给的试卷并给出自己的对应的答案. 实现: static void Main(string[] args) { Console.WriteLine("学生甲抄的试卷:&quo ...

  2. PHP获取地址栏传的id值

    function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...

  3. csharp:SQLite and Access using C# code read data

    SQLite sql script: CREATE TABLE BookKindList ( BookKindID INTEGER PRIMARY KEY AUTOINCREMENT, BookKin ...

  4. 【转载】MySQL数据库可以用任意ip连接访问的方法

    通过CMD命令行修改数据库表的一个字段的值,实现连接,访问. 第一步.找到MYSQL软件安装所在的bin目录: (1)cd\当前目录 (2)指定MYSQL安装的bin目录 (3)输入 -h local ...

  5. C#可遍历的集合

    public class Product { /// <summary> /// 自增ID /// </summary> public int ID { get; set; } ...

  6. jQuery 滚动条滚动

    1.将div的滚动条滚动到最底端 <div class="container"></div> var $container=$(".contain ...

  7. <Android 基础(二十一)> Android 屏幕适配

    基本概念 1. 什么是屏幕尺寸.屏幕分辨率.屏幕像素密度? 屏幕尺寸是指屏幕对角线的长度.单位是英寸,1英寸=2.54厘米 屏幕分辨率是指在横纵向上的像素点数,单位是px,1px=1像素点,一般是纵向 ...

  8. System Monitor ArcGIS系统监控利器

    System Monitor是Esri推出的GIS系统监控工具,对于GIS数据中心的运维人员是难得的利器.早期版本是开源免费的解决方案,在今年的Esri 全球用户大会上,Esri宣布将发行商业版的Sy ...

  9. js 判断 复选框全选、全不选、反选、必选一个

    一个挺 使用的 js 代码片段,  判断  复选框全选.全不选.反选.必选一个 记录下, 搬来的 思路: 修改数据的 选中与否状态, 拿到所有的输入框,看是否有选中的状态 <html> & ...

  10. LeetCode赛题393----UTF-8 Validation

    393. UTF-8 Validation A character in UTF8 can be from 1 to 4 bytes long, subjected to the following ...