当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 3 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : ubuntu10.10配置sun-jdk1.6.0_23全过程的终端代码!
帖子发表于 : 2010-12-19 10:57 

注册: 2010-12-17 21:19
帖子: 22
送出感谢: 0 次
接收感谢: 0 次
knight@ubuntu:~$ gedit /etc/environment
knight@ubuntu:~$ sudo gedit /etc/environmenf
[sudo] password for knight:
knight@ubuntu:~$ sudo gedit /etc/environment
knight@ubuntu:~$ sudo update-alternatives --install /home/knight knight/jdk1.6.0_23/bin/java 300
update-alternatives: --install 需要 <链接> <名称> <路径> <优先级>

Usage: update-alternatives [<option> ...] <command>

Commands:
--install <link> <name> <path> <priority>
[--slave <link> <name> <path>] ...
add a group of alternatives to the system.
--remove <name> <path> remove <path> from the <name> group alternative.
--remove-all <name> remove <name> group from the alternatives system.
--auto <name> switch the master link <name> to automatic mode.
--display <name> display information about the <name> group.
--query <name> machine parseable version of --display <name>.
--list <name> display all targets of the <name> group.
--config <name> show alternatives for the <name> group and ask the
user to select which one to use.
--set <name> <path> set <path> as alternative for <name>.
--all call --config on all alternatives.

<link> is the symlink pointing to /etc/alternatives/<name>.
(e.g. /usr/bin/pager)
<name> is the master name for this link group.
(e.g. pager)
<path> is the location of one of the alternative target files.
(e.g. /usr/bin/less)
<priority> is an integer; options with higher numbers have higher priority in
automatic mode.

Options:
--altdir <directory> change the alternatives directory.
--admindir <directory> change the administrative directory.
--skip-auto skip prompt for alternatives correctly configured
in automatic mode (relevant for --config only)
--verbose verbose operation, more output.
--quiet quiet operation, minimal output.
--help show this help message.
--version show the version.
knight@ubuntu:~$ sudo update-alternatives --install /home/knight java /jdk1.6.0_23/bin/java 300
update-alternatives: error: 替代路径 /jdk1.6.0_23/bin/java 不存在
knight@ubuntu:~$ sudo update-alternatives --install /home/knight java /jdk1.6.0_23/bin 300
update-alternatives: error: 替代路径 /jdk1.6.0_23/bin 不存在
knight@ubuntu:~$ sudo update-alternatives --install /home/knight java ./jdk1.6.0_23/bin/java 300
update-alternatives: error: 替换路径不是绝对路径,它应该是绝对路径:./jdk1.6.0_23/bin/java
knight@ubuntu:~$ sudo update-alternatives --install /home/knight java home/knight/jdk1.6.0_23/bin 300
update-alternatives: error: 替换路径不是绝对路径,它应该是绝对路径:home/knight/jdk1.6.0_23/bin
knight@ubuntu:~$ sudo update-alternatives --install /home/knight java /home/knight/jdk1.6.0_23/bin 300
update-alternatives: 正在将链接 java 的名称从 /usr/bin/java 改成 /home/knight。
update-alternatives: 警告: forcing reinstallation of alternative /usr/lib/jvm/java-6-openjdk/jre/bin/java because link group java is broken.
update-alternatives: 警告: 未将 /home/knight 替换为链接。
knight@ubuntu:~$ sudo update-alternatives --install /home/knight/jdk1.6.0_23 java /home/knight/jdk1.6.0_23/bin/java 300
update-alternatives: 警告: forcing reinstallation of alternative /usr/lib/jvm/java-6-openjdk/jre/bin/java because link group java is broken.
update-alternatives: 警告: 未将 /home/knight/jdk1.6.0_23 替换为链接。
knight@ubuntu:~$ sudo update-alternatives --install /usr/bin/java java /home/knight/jdk1.6.0_23/bin/java 300
update-alternatives: 警告: forcing reinstallation of alternative /usr/lib/jvm/java-6-openjdk/jre/bin/java because link group java is broken.
knight@ubuntu:~$ sudo update-alternatives --install /usr/bin/javac javac /home/knight/jdk1.6.0_23/bin/javac 300
update-alternatives: 使用 /home/knight/jdk1.6.0_23/bin/javac 来提供 /usr/bin/javac (javac),于 自动模式 中。
knight@ubuntu:~$ sudo update-alternatives --config java
There are 4 choices for the alternative java (providing /usr/bin/java).

选择 路径 优先级 状态
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 自动模式
1 /home/knight/jdk1.6.0_23/bin 300 手动模式
2 /home/knight/jdk1.6.0_23/bin/java 300 手动模式
3 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 手动模式
4 /usr/lib/jvm/java-6-sun/jre/bin/java 63 手动模式

要维持当前值[*]请按回车键,或者键入选择的编号:2
update-alternatives: 使用 /home/knight/jdk1.6.0_23/bin/java 来提供 /usr/bin/java (java),于 手动模式 中。
knight@ubuntu:~$ java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Server VM (build 19.0-b09, mixed mode)
knight@ubuntu:~$ javac /home/knight/HelloWorld.java
knight@ubuntu:~$ java /home/knight/HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: /home/knight/HelloWorld
Caused by: java.lang.ClassNotFoundException: .home.knight.HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: /home/knight/HelloWorld. Program will exit.
knight@ubuntu:~$ cd /home/knight
knight@ubuntu:~$ java HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld (wrong name: test/HelloWorld)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: HelloWorld. Program will exit.
knight@ubuntu:~$ cd /home/knight
knight@ubuntu:~$ java /home/knight/HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: /home/knight/HelloWorld
Caused by: java.lang.ClassNotFoundException: .home.knight.HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: /home/knight/HelloWorld. Program will exit.
knight@ubuntu:~$ javac /home/knight/HelloWorld.java
knight@ubuntu:~$ java /home/knight/HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: /home/knight/HelloWorld
Caused by: java.lang.ClassNotFoundException: .home.knight.HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: /home/knight/HelloWorld. Program will exit.
knight@ubuntu:~$ cd ./home/knight
bash: cd: ./home/knight: 没有那个文件或目录
knight@ubuntu:~$ cd /home/knight
knight@ubuntu:~$ cd/home/knight
bash: cd/home/knight: 没有那个文件或目录
knight@ubuntu:~$ cd /home/knight
knight@ubuntu:~$ java HelloWorld
hello,java!


页首
 用户资料  
 
2 楼 
 文章标题 : Re: ubuntu10.10配置sun-jdk1.6.0_23全过程的终端代码!
帖子发表于 : 2010-12-19 11:49 
头像

注册: 2008-11-01 20:43
帖子: 17331
系统: Arch+gnome
送出感谢: 44
接收感谢: 11
搞安猪开发?


_________________
谁是我?KL.Uiq8 YinMeng


页首
 用户资料  
 
3 楼 
 文章标题 : Re: ubuntu10.10配置sun-jdk1.6.0_23全过程的终端代码!
帖子发表于 : 2010-12-19 18:39 

注册: 2010-12-17 21:19
帖子: 22
送出感谢: 0 次
接收感谢: 0 次
java开发!


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 3 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译