Linux下jdk以及tomcat的环境变量到底要设置在哪个文件中?在线等,希望大家踊跃发言!

yuyangwxj 2006-09-05 09:33:45
安装完了,在哪设置环境变量?
说法一堆:
1.用export命令直接在shell下设置,但是只对当前shell生效。如果从另外一个shell登陆,将不能使用刚才设置的变量。

2.在/etc/profile.d下面建立一个java.sh,把环境变量写里面
(这个我刚用,不好使!)

3.把设置的环境变量放在/etc/profile后面
(profile是一个文件,不是文件夹)

4.修改.bashr这个文件(我没找到在哪)

到底用哪个好使?
...全文
3737 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
mayabin 2006-09-07
  • 打赏
  • 举报
回复
不管你用什么系统,jdk和tomcat的安装说明是没有问题的,
$CATALINA_HOME是tomcat环境变量设置参数
JAVA_HOME=/是java的环境变量参数。

我查了一下centos的环境变量设置,没有特殊的地方,/etc/profile就可以。

你的tomcat起不来,不一定是环境变量的原因。

建议你不要着急,按着安装说明,踏踏实实的往下做。
csl610 2006-09-07
  • 打赏
  • 举报
回复
大家一起来讨论一下,linux下java开发是否有前途?

群号:28941757 欢迎大家一起加入。
yuyangwxj 2006-09-07
  • 打赏
  • 举报
回复
现在配置都配置好了,可是就是在JSP文件连接数据库的时候出错
http://localhost:8080/jsptest/mysqltest.jsp

出错,就是连不上数据库
无知者无谓 2006-09-06
  • 打赏
  • 举报
回复
一般我写在/etc/profile中
csl610 2006-09-06
  • 打赏
  • 举报
回复
大家一起来讨论一下,linux下java开发是否有前途?

群号:28941757 欢迎大家一起加入。
mayabin 2006-09-06
  • 打赏
  • 举报
回复
yuyangwxj 2006-09-06
  • 打赏
  • 举报
回复
跟JAVA_HOME设置在一起吗?
mayabin 2006-09-06
  • 打赏
  • 举报
回复
$CATALINA_HOME是tomcat环境变量设置参数
yuyangwxj 2006-09-06
  • 打赏
  • 举报
回复
我是这么设置的:
/root/.bashrc

#set java environment
JAVA_HOME=/usr/java/j2sdk1.4.2_12
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH

TOMCAT的环境变量要设置在哪里?怎么设置!简单点就行,得先让那个小猫出来呀
fengfangfang 2006-09-06
  • 打赏
  • 举报
回复
在/etc/profile里面写
mayabin 2006-09-06
  • 打赏
  • 举报
回复
都好用,环境变量有好多种设置方法
/etc中的profile,bashrc
用户目录的bashrc,
export

但是有优先级,
export>~HOME>/etc/xx

export后,会直接生效(但是重启后丢失),其他两种不会立即生效,需要重新登陆。
yuyangwxj 2006-09-06
  • 打赏
  • 举报
回复
在网上看了很多,愣是没有配置起来
晕了晕了 2006-09-06
  • 打赏
  • 举报
回复
这里有篇介绍安装tomcat的,你可以参考一下
http://bbs.chinaunix.net/viewthread.php?tid=816902&highlight=tomcat
yuyangwxj 2006-09-06
  • 打赏
  • 举报
回复
我现在运行JAVA没问题,但是TOMCAT就是配置不起来,郁闷!
晕了晕了 2006-09-06
  • 打赏
  • 举报
回复
我用的也是CentOS,我没有装Tomcat,只装了jdk1.5 我是在/etc/profile中设置的
export JAVA_HOME=/opt/jdk1.5.0_07
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH =,:$JAVA_HOME/lib/tools.jar:$CLASSPATH
运行java程序没有任何问题.
yuyangwxj 2006-09-06
  • 打赏
  • 举报
回复
来人帮忙呀!
郁闷呀!
yuyangwxj 2006-09-06
  • 打赏
  • 举报
回复
我用的是CentOS系统,不好使呀,怎么设置都不行!
yuyangwxj 2006-09-05
  • 打赏
  • 举报
回复
[root@kjxm bin]# ps -aux
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.2 3064 560 ? S 18:22 0:00 init [5]
root 2 0.0 0.0 0 0 ? SN 18:22 0:00 [ksoftirqd/0]
root 3 0.0 0.0 0 0 ? S< 18:22 0:00 [events/0]
root 4 0.0 0.0 0 0 ? S< 18:22 0:00 [khelper]
root 5 0.0 0.0 0 0 ? S< 18:22 0:00 [kacpid]
root 22 0.0 0.0 0 0 ? S< 18:22 0:00 [kblockd/0]
root 35 0.0 0.0 0 0 ? S< 18:22 0:00 [aio/0]
root 23 0.0 0.0 0 0 ? S 18:22 0:00 [khubd]
root 34 0.0 0.0 0 0 ? S 18:22 0:00 [kswapd0]
root 109 0.0 0.0 0 0 ? S 18:22 0:00 [kseriod]
root 187 0.0 0.0 0 0 ? S 18:22 0:00 [kjournald]
root 1050 0.0 0.1 1732 448 ? S<s 18:22 0:00 udevd
root 1680 0.0 0.0 0 0 ? S< 18:22 0:00 [kauditd]
root 1724 0.0 0.0 0 0 ? S< 18:22 0:00 [kmirrord]
root 1725 0.0 0.0 0 0 ? S< 18:22 0:00 [kmir_mon]
root 1747 0.0 0.0 0 0 ? S 18:22 0:00 [kjournald]
root 1748 0.0 0.0 0 0 ? S 18:22 0:00 [kjournald]
root 1749 0.0 0.0 0 0 ? S 18:22 0:00 [kjournald]
root 2116 0.0 0.2 2252 632 ? Ss 18:23 0:00 syslogd -m 0
root 2120 0.0 0.1 1772 468 ? Ss 18:23 0:00 klogd -x
rpc 2142 0.0 0.2 2980 572 ? Ss 18:23 0:00 portmap
rpcuser 2162 0.0 0.2 2092 760 ? Ss 18:23 0:00 rpc.statd
root 2190 0.0 0.3 5544 992 ? Ss 18:23 0:00 rpc.idmapd
root 2267 0.0 0.3 3004 816 ? S 18:23 0:00 /usr/sbin/smartd
root 2277 0.0 0.2 1840 544 ? Ss 18:23 0:00 /usr/sbin/acpid
root 2289 0.0 0.9 10264 2352 ? Ss 18:23 0:00 cupsd
root 2325 0.0 0.6 5512 1708 ? Ss 18:23 0:00 /usr/sbin/sshd
root 2340 0.0 0.3 4068 844 ? Ss 18:23 0:00 xinetd -stayalive
root 2359 0.0 1.2 7848 3100 ? Ss 18:23 0:00 sendmail: accepti
smmsp 2367 0.0 1.0 7988 2584 ? Ss 18:23 0:00 sendmail: Queue r
root 2378 0.0 0.2 3012 524 ? Ss 18:23 0:00 gpm -m /dev/input
htt 2409 0.0 0.1 1488 316 ? Ss 18:23 0:00 /usr/sbin/htt -re
htt 2410 0.0 2.6 62404 6724 ? Sl 18:23 0:00 htt_server -nodae
root 2420 0.0 0.4 7072 1156 ? Ss 18:23 0:00 crond
xfs 2445 0.0 1.2 18684 3208 ? Ss 18:23 0:00 xfs -droppriv -da
root 2464 0.0 0.2 2868 744 ? Ss 18:23 0:00 /usr/sbin/atd
dbus 2483 0.0 0.5 13616 1340 ? Ssl 18:23 0:00 dbus-daemon-1 --s
root 2494 0.0 0.4 4028 1040 ? Ss 18:23 0:00 cups-config-daemo
root 2505 0.0 2.1 7436 5432 ? Ss 18:23 0:10 hald
root 2515 0.0 0.1 1464 404 tty1 Ss+ 18:23 0:00 /sbin/mingetty tt
root 2540 0.0 0.1 3184 404 tty2 Ss+ 18:23 0:00 /sbin/mingetty tt
root 2647 0.0 0.1 1640 404 tty3 Ss+ 18:23 0:00 /sbin/mingetty tt
root 2678 0.0 0.1 1528 404 tty4 Ss+ 18:23 0:00 /sbin/mingetty tt
root 2742 0.0 0.1 2160 404 tty5 Ss+ 18:23 0:00 /sbin/mingetty tt
root 2759 0.0 0.1 3456 404 tty6 Ss+ 18:23 0:00 /sbin/mingetty tt
root 2784 0.0 0.9 12688 2372 ? Ss 18:23 0:00 /usr/bin/gdm-bina
root 2847 0.0 1.3 13540 3412 ? S 18:23 0:00 /usr/bin/gdm-bina
root 2852 2.7 7.1 22840 18248 ? S 18:23 7:46 /usr/X11R6/bin/X
root 3202 0.0 0.4 4256 1152 ? Ss 18:24 0:00 /usr/bin/ssh-agen
root 3745 0.0 0.0 0 0 ? S 19:12 0:00 [pdflush]
root 3756 0.0 0.0 0 0 ? S 19:12 0:00 [pdflush]
yuyang 4883 0.0 1.1 8560 2996 ? S 21:53 0:00 /usr/libexec/gcon
yuyang 4893 0.0 0.4 5140 1148 ? Ss 21:53 0:00 /usr/bin/ssh-agen
root 5233 0.0 0.4 5096 1152 ? Ss 22:05 0:00 /usr/bin/ssh-agen
root 5667 0.0 4.2 32192 10988 ? Ss 22:28 0:00 /usr/bin/gnome-se
root 5693 0.0 3.3 13660 8492 ? S 22:28 0:01 /usr/libexec/gcon
root 5694 0.0 0.4 6292 1096 ? S 22:28 0:00 /bin/bash /etc/X1
root 5699 0.0 0.5 7108 1352 ? S 22:28 0:00 httx
root 5700 0.0 1.3 23448 3456 ? Sl 22:28 0:00 htt_xbe
root 5703 0.0 0.4 4536 1152 ? Ss 22:28 0:00 /usr/bin/ssh-agen
root 5736 0.0 0.2 2712 660 ? S 22:28 0:00 /usr/bin/dbus-lau
root 5737 0.0 0.5 13876 1296 ? Ssl 22:28 0:00 dbus-daemon-1 --f
root 5744 0.0 2.1 22308 5572 ? S 22:28 0:00 com.redhat.chinpu
root 5747 0.0 0.3 3328 884 ? S 22:28 0:00 /usr/bin/gnome-ke
root 5749 0.0 1.0 8928 2724 ? Ss 22:28 0:00 /usr/libexec/bono
root 5751 0.0 2.8 20376 7348 ? S 22:28 0:00 /usr/libexec/gnom
root 5757 0.0 0.4 2540 1264 ? S 22:28 0:00 /usr/libexec/gam_
root 5780 0.2 3.2 25604 8404 ? Ss 22:28 0:04 /usr/bin/metacity
root 5793 0.1 6.6 36568 17116 ? Ss 22:28 0:02 gnome-panel --sm-
root 5795 0.6 10.6 59652 27228 ? Ssl 22:28 0:14 nautilus --no-def
root 5797 0.0 2.4 20676 6380 ? Ss 22:28 0:00 gnome-volume-mana
root 5799 0.0 2.9 42196 7616 ? Ssl 22:28 0:00 eggcups --sm-clie
root 5801 0.0 1.8 15164 4712 ? Ss 22:28 0:00 pam-panel-icon --
root 5803 0.1 7.6 36068 19564 ? RNs 22:28 0:02 /usr/bin/python /
root 5804 0.0 0.2 2736 536 ? S 22:28 0:00 /sbin/pam_timesta
root 5809 0.0 1.4 22636 3664 ? Sl 22:28 0:00 /usr/libexec/gnom
root 5818 0.0 0.2 3856 680 ? S 22:28 0:00 /usr/libexec/mapp
root 5820 0.1 4.8 33220 12356 ? S 22:29 0:03 /usr/libexec/wnck
root 5822 0.0 3.8 23576 9788 ? S 22:29 0:00 /usr/libexec/mixe
root 5824 0.0 4.9 54792 12556 ? Sl 22:29 0:00 /usr/libexec/cloc
root 5826 0.0 2.7 19796 6968 ? S 22:29 0:00 /usr/libexec/noti
root 5828 0.0 3.6 31196 9400 ? S 22:29 0:00 /usr/libexec/gnom
root 5938 0.0 3.8 24852 9932 ? S 22:36 0:00 /usr/libexec/naut
root 5970 0.0 0.4 5676 1060 ? S 22:47 0:00 /bin/sh /usr/lib/
root 6000 0.0 0.4 6568 1068 ? S 22:47 0:00 /bin/sh /usr/lib/
root 6005 0.3 9.9 102868 25372 ? Sl 22:47 0:03 /usr/lib/firefox-
root 6014 0.0 4.8 46416 12320 ? Sl 22:47 0:00 gnome-terminal
root 6016 0.0 0.2 3628 608 ? S 22:47 0:00 gnome-pty-helper
root 6017 0.0 0.5 6260 1404 pts/1 Ss 22:47 0:00 bash
root 6074 0.0 1.8 47092 4620 ? Sl 22:54 0:00 /usr/libexec/evol
root 6195 0.0 0.2 3296 748 pts/1 R+ 23:02 0:00 ps -aux
yuyangwxj 2006-09-05
  • 打赏
  • 举报
回复
.bashrc这个文件是自己建立的还是本身系统就有的?
yuyangwxj 2006-09-05
  • 打赏
  • 举报
回复
sink你还在不了?在的话回话
加载更多回复(2)

23,118

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧