正式版, java环境变量设置不成功
Tofloor
poster avatar
longhornxp1
deepin
2015-12-31 23:20
Author
在正式版中,/etc/profile
末尾加入
export PATH=$PATH:/opt/java
但是重启动后,并没有java,直接source /etc/profile有java
Reply Favorite View the author
All Replies
Feng Yu
deepin
2015-12-31 23:30
#1
写到~/.bashrc,/etc/profile不要随便写进去,十有八九不生效,别被国内资料误导
Reply View the author
longhornxp1
deepin
2015-12-31 23:37
#2
好的,为什么在deepin console中,export 的变量只对当前环境生效,不对系统生效?
Reply View the author
主观能动性
deepin
2015-12-31 23:53
#3
终端依次执行下面的命令:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

如果你想安装Java 7(i.e Java 1.7),在上面的命令中用java7代替java8。
Reply View the author
longhornxp1
deepin
2016-01-01 00:13
#4
谢谢,我是下的tar.gz包,手动装的,我有空试试你的方法
Reply View the author
Feng Yu
deepin
2016-01-01 00:15
#5
https://bbs.deepin.org/post/35007
终端依次执行下面的命令:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

2014可以这么用,15不支持ppa了。ppa本来也就只是给ubuntu用的,debian不支持。

debian sid直接装openjdk-8-jdk这个包就行了
Reply View the author
Feng Yu
deepin
2016-01-01 00:16
#6
https://bbs.deepin.org/post/35007
好的,为什么在deepin console中,export 的变量只对当前环境生效,不对系统生效? ...

export本来就不是对整个系统生效的。你查查export的含义就知道了。只是把某个变量输出到子进程而已
Reply View the author
smilejason
deepin
2016-01-01 00:58
#7
这不科学啊
用户登录不是应该先执行/etc/profile的么
Reply View the author
refree
deepin
2016-01-01 01:01
#8
https://bbs.deepin.org/post/35007
写到~/.bashrc,/etc/profile不要随便写进去,十有八九不生效,别被国内资料误导 ...

beta版已测试,写到/etc/profile确实无效
Reply View the author
shulun743
deepin
2016-01-01 01:10
#9
https://bbs.deepin.org/post/35007
终端依次执行下面的命令:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

deepin2015    不支持 ppa吧?
Reply View the author
jesonzhuang
deepin
2016-01-01 01:10
#10
配置成功   只是 phpstorm等开发工具 没法识别 不知道咋回事
Reply View the author
Feng Yu
deepin
2016-01-01 01:27
#11
https://bbs.deepin.org/post/35007
配置成功   只是 phpstorm等开发工具 没法识别 不知道咋回事

这种工具用脚本启动的,是非登录式shell执行,所以不执行/etc/profile
Reply View the author
jesonzhuang
deepin
2016-01-01 01:47
#12
问题是  添加到  ~/.bashrs 后   在终端下可以找到  但是在开发工具还是找不到
Reply View the author
jesonzhuang
deepin
2016-01-01 01:57
#13
https://bbs.deepin.org/post/35007
这种工具用脚本启动的,是非登录式shell执行,所以不执行/etc/profile

问题是  添加到  ~/.bashrs 后   在终端下可以找到  但是在开发工具还是找不到
Reply View the author
smilejason
deepin
2016-01-01 02:00
#14
https://bbs.deepin.org/post/35007
问题是  添加到  ~/.bashrs 后   在终端下可以找到  但是在开发工具还是找不到 ...

看你是哪个用户
root用户下一般来说可以的
Reply View the author
jesonzhuang
deepin
2016-01-01 02:05
#15
https://bbs.deepin.org/post/35007
看你是哪个用户
root用户下一般来说可以的

以前都可以  这次不行的
Reply View the author
h***a@gmail.com
deepin
2016-01-01 02:11
#16
Reply View the author
MeowSprite
deepin
2016-01-01 04:23
#17
https://bbs.deepin.org/post/35007
问题是  添加到  ~/.bashrs 后   在终端下可以找到  但是在开发工具还是找不到 ...

.bashrc 是 bash shell下的环境配置,就是你每次打开bash(可以认为就是终端)的时候,他会调用这些配置。把你自定义配置写在~/.profile下,然后使用source ~/.profile命令来让系统加载这些配置。
Reply View the author
jesonzhuang
deepin
2016-01-03 03:57
#18
https://bbs.deepin.org/post/35007
.bashrc 是 bash shell下的环境配置,就是你每次打开bash(可以认为就是终端)的时候,他会调用这些配置 ...

谢谢  明天试一下
Reply View the author
zhang12345shun
deepin
2016-01-17 09:11
#19
1. 下载Sun版JDK压缩包(.tar.gz),选择其中的32/64位Linux版本。
2. 将其解压缩:sudo tar -zxvf ~/Downloads/jdk-8u45-linux-i586.tar.gz -C /usr/lib 中参数-C后面的路径是解压缩的目标路径。
3.sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_66/bin/java 1000
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_66/bin/javac 1000
Reply View the author
zhang12345shun
deepin
2016-01-17 09:41
#20
参考官网:
Starting with version 8u40, the JDK installation is integrated with the alternatives framework and after installation, the alternatives framework is updated to reflect the binaries from the recently installed JDK. Java commands such as java, javac, javadoc, and javap can be invoked from the command line.
Reply View the author