[英]Using Java on Ubuntu - Package conflict?
On linux, I often launch and compile from the command line (java/javac) Though, Java isn't the only language I use - I use C++, and for that I have GCC. 在Linux上,我经常从命令行(java / javac)启动和编译。尽管如此,Java不是我使用的唯一语言-我使用C ++,因此我拥有GCC。 Because I have both java and GCC, for example, there are more than one instance of 'javac':
例如,因为我同时具有java和GCC,所以有多个'javac'实例:
From the terminal, passing 'javac' with no arguments: 从终端传递不带参数的“ javac”:
The program 'javac' can be found in the following packages: * openjdk-6-jdk * ecj * gcj-4.4-jdk * gcj-4.5-jdk Try: sudo apt-get install 程序“ javac”可在以下软件包中找到:* openjdk-6-jdk * ecj * gcj-4.4-jdk * gcj-4.5-jdk尝试:sudo apt-get install
Is there a way to specify which package I want to use? 有没有一种方法可以指定我要使用的软件包? Either per-command, or set a default?
每个命令还是设置默认值? I would prefer not to remove one or the other.
我希望不要删除其中一个。
Thanks - Zac 谢谢-扎克
update-java-alternatives -s openjdk-6-jdk
On Ubuntu there is a system called alternatvies
installed, to switch between different implementations: 在Ubuntu上,安装了一个名为
alternatvies
系统,可以在不同的实现之间进行切换:
update-java-alternatives
man update-java-alternatives
shows the usage: 显示用法:
NAME
update-java-alternatives - update alternatives for jre/sdk installations
SYNOPSIS
update-java-alternatives [--jre] [--plugin] [-t|--test|-v|--verbose]
-l|--list [<jname>]
-s|--set <jname>
-a|--auto
-h|-?|--help
If you get problems with swing, you should try sun-java, which you're missing in your list. 如果您在使用swing时遇到问题,则应尝试使用sun-java,但您没有在列表中找到它。 :)
:)
As 'KindOfAutomatic suggests: 正如'KindOfAutomatic建议:
alternatives --config java
alternatives --config javac
is the same thing in a different way. 是同一件事,只是方式不同。 Instead of 'java', you can config your favorite editor, x-www-browser, pager and so on as well.
除了“ java”,您还可以配置自己喜欢的编辑器,x-www-browser,pager等。 Have a look at
看一下
ls /etc/alternatives
to get an impression, what's already done there. 为了给人留下深刻的印象,那里已经做了什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.