免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: zhangyan@tq.cn
打印 上一主题 下一主题

更改了.bash_profile导致普通用户的tomcat起不来[已解决] [复制链接]

论坛徽章:
0
21 [报告]
发表于 2006-12-13 14:35 |只看该作者
原文就是这样的:
-bash: /home/work/.bash_profile: line 40: syntax error: unexpected end of file
-bash-3.00$ vi .bash_profile




















PATH=./:/usr/java/j2sdk1.4.1_02/binPATH;export PATH
#PATH=$PATHJAVA_HOME/bin
CLASSPATH=.:/usr/java/j2sdk1.4.1_02/bin:/usr/java/j2sdk1.4.1_02/lib:/home/work/21ct:/home/work/21ct/lib/mssqlserver.jar:/home/work/21ct/lib/chart/jfreechart-1.0.0-rc1.jar:/home/work/21ct/lib/chart/gnujaxp.jar:/home/work/21ct/lib/chart/jcommon-1.0.0-rc1.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mm.mysql-2.0.4-bin.jar:/home/work/21ct/lib/chart/junit.jar:/home/work/21ct/lib/servlet.jar:/home/work/21ct/lib/chart/servlet.jar:/home/work/21ct/lib/msbase.jar:/home/work/21ct/lib/msutil.jar:/home/work/jtom/bin/bootstrap.jar:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/home/work/21ct/lib/jdom.jar:/home/work/21ct/lib/jaxp.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mail.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mysql-connector-java-3.1.12-bin.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/classes12.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/activation.jar:/home/work/jtom/webapps/ROOT/WEB-INF/classes
export CLASSPATH

export PATH
export JAVA_HOME
export JAVA_OPTS
export CATALINA_OPTS
unset USERNAME
export CLASSPATH

".bash_profile" [dos] 39L, 1582C                              39,0-1        Bot
请大家帮分析一下!!!!
不胜感激!!!

论坛徽章:
0
22 [报告]
发表于 2006-12-13 14:55 |只看该作者
Your CLASSPATH is 6 lines!!! You need to join them ( 6 lines) into one line.

论坛徽章:
0
23 [报告]
发表于 2006-12-13 15:26 |只看该作者
OK. I counted your lines and it seems that the CLASSPATH is one line. So my previous suggest was garbage. Try the following:

vi .bash_profile
:set list

This will show up all the hidden chars. Post your result if you need help

论坛徽章:
0
24 [报告]
发表于 2006-12-13 15:33 |只看该作者
And there are a couple of mistakes there:

PATH=/usr/java/jdk1.5.0_06/binPATH;export PATH
PATH=./:/usr/java/j2sdk1.4.1_02/binPATH;export PATH

Should be:

PATH=/usr/java/jdk1.5.0_06/binPATH;export PATH
PATH=.:/usr/java/j2sdk1.4.1_02/binPATH;export PATH

Also you need to realize, by doing so, your j2sdk will be used when user runs tomcat instead of jdk1.5.0

论坛徽章:
0
25 [报告]
发表于 2006-12-13 15:46 |只看该作者
try "dos2unix" or "unix2dos" cmd
用鼠标cp & paste的东西不太靠得住,比如\t

论坛徽章:
0
26 [报告]
发表于 2006-12-13 18:07 |只看该作者
最原始的文件是这样的
-bash-3.00$ vi .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs



#export PATH
#unset USERNAME
JAVA_HOME=/usr/java/j2sdk1.4.1_02/

JAVA_OPTS="-server -Xmx256m -Xms128m"
CATALINA_OPTS="-Xms128m -Xmx512m"
#export JAVA_HOME
#export JAVA_OPTS
#export CATALINA_OPTS

#PATH=$PATHHOME/bin

#export PATH
#unset USERNAME

PATH=/usr/java/jdk1.5.0_06/binPATH;export PATH
PATH=./:/usr/java/j2sdk1.4.1_02/binPATH;export PATH
#PATH=$PATHJAVA_HOME/bin
CLASSPATH=.:/usr/java/j2sdk1.4.1_02/bin:/usr/java/j2sdk1.4.1_02/lib:/home/work/21ct:/home/work/21ct/lib/mssqlserver.jar:/home/work/21ct/lib/chart/jfreechart-1.0.0-rc1.jar:/home/work/21ct/lib/chart/gnujaxp.jar:/home/work/21ct/lib/chart/jcommon-1.0.0-rc1.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mm.mysql-2.0.4-bin.jar:/home/work/21ct/lib/chart/junit.jar:/home/work/21ct/lib/servlet.jar:/home/work/21ct/lib/chart/servlet.jar:/home/work/21ct/lib/msbase.jar:/home/work/21ct/lib/msutil.jar:/home/work/jtom/bin/bootstrap.jar:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/home/work/21ct/lib/jdom.jar:/home/work/21ct/lib/jaxp.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mail.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mysql-connector-java-3.1.12-bin.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/classes12.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/activation.jar:/home/work/jtom/webapps/ROOT/WEB-INF/classes
export CLASSPATH

export PATH
export JAVA_HOME
export JAVA_OPTS
export CATALINA_OPTS
unset USERNAME
export CLASSPATH

                                                              39,0-1        Bot

briangao (Brian),帮看一下,这样还需要怎么修改.
第一次登陆进如work是:
Last login: Wed Dec 13 12:52:10 2006 from 61.48.222.68
: command not found
-bash: /home/work/.bash_profile: line 40: syntax error: unexpected end of file
-bash-3.00$

上面有笑脸的地方是":".

[ 本帖最后由 zhangyan@tq.cn 于 2006-12-13 18:09 编辑 ]

论坛徽章:
0
27 [报告]
发表于 2006-12-13 20:21 |只看该作者

肯定是有其他的不可见符号比如换行符回车符

一次一个朋友的一个shell也是这样,估计在哪一行有个回车符,结果shell始终不对,然后新建了一个shell,手工一个一个敲,就没事了。

论坛徽章:
0
28 [报告]
发表于 2006-12-13 22:43 |只看该作者
OK, there are a few type errors in your profile and some hidden chars (I bet). So I cleaned it up a bit. Try the following and it should work.

1. Save your current .bash_profile.  cp  -p  .bash_profile  .bash_profile.save
2. vi .bash_profile. Erase everything in it and cut and paste the following into it ( Starting #Get the aliases ...)
3. Save .bash_profile
4. Type wc  -l  .bash_profile  (where l is the lower case  L). It should return number 23. This guarantees that the CLASSPATH is on one line
5. Login again

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

JAVA_HOME=/usr/java/j2sdk1.4.1_02

JAVA_OPTS="-server -Xmx256m -Xms128m"
CATALINA_OPTS="-Xms128m -Xmx512m"

#PATH=/usr/java/jdk1.5.0_06/binPATH
PATH=.JAVA_HOME/binPATH

CLASSPATH=.:/usr/java/j2sdk1.4.1_02/bin:/usr/java/j2sdk1.4.1_02/lib:/home/work/21ct:/home/work/21ct/lib/mssqlserver.jar:/home/work/21ct/lib/chart/jfreechart-1.0.0-rc1.jar:/home/work/21ct/lib/chart/gnujaxp.jar:/home/work/21ct/lib/chart/jcommon-1.0.0-rc1.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mm.mysql-2.0.4-bin.jar:/home/work/21ct/lib/chart/junit.jar:/home/work/21ct/lib/servlet.jar:/home/work/21ct/lib/chart/servlet.jar:/home/work/21ct/lib/msbase.jar:/home/work/21ct/lib/msutil.jar:/home/work/jtom/bin/bootstrap.jar:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/home/work/21ct/lib/jdom.jar:/home/work/21ct/lib/jaxp.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mail.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/mysql-connector-java-3.1.12-bin.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/classes12.jar:/home/work/jtom/webapps/ROOT/WEB-INF/lib/activation.jar:/home/work/jtom/webapps/ROOT/WEB-INF/classes

export PATH
export JAVA_HOME
export JAVA_OPTS
export CATALINA_OPTS
unset USERNAME
export CLASSPATH

论坛徽章:
0
29 [报告]
发表于 2006-12-14 10:30 |只看该作者
曾经在windows下编辑过work下的.bash_profile吧,用dos2unix转换回来。
以后用windows下的编辑器,注意要设置ftp打开的文件格式为unix。

论坛徽章:
0
30 [报告]
发表于 2006-12-14 11:46 |只看该作者
切换到root用户你起一下看看
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP