mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
20151105-3 选题
This commit is contained in:
parent
0a6141a53f
commit
d4806aa3c4
@ -0,0 +1,52 @@
|
||||
Linux FAQs with Answers--How to change default Java version on Linux
|
||||
================================================================================
|
||||
> **Question**: When I am trying to run a Java program on Linux, I am getting the following error. Looks like the Java program is compiled for a different Java version than the default Java program installed on my Linux. How can I switch the default Java version on Linux?
|
||||
>
|
||||
> Exception in thread "main" java.lang.UnsupportedClassVersionError: com/xmodulo/hmon/gui/NetConf : Unsupported major.minor version 51.0
|
||||
|
||||
When a Java program is compiled, the build environment sets a "target" which is the oldest JRE version the program can support. If you run the Java program on a Linux system which does not meet the lowest JRE version requirement, you will encounter the following error while starting the program.
|
||||
|
||||
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/xmodulo/hmon/gui/NetConf : Unsupported major.minor version 51.0
|
||||
|
||||
For example, in this case the program is compiled for Java JRE 1.7 but the system only has Java JRE 1.6.
|
||||
|
||||
To solve this problem, you need to change the default Java version you are using to Java JRE 1.7 or higher (assuming that such JRE is already installed).
|
||||
|
||||
First, **check available Java versions** on your Linux system by using update-alternatives command:
|
||||
|
||||
$ sudo update-alternatives --display java
|
||||
|
||||
![](https://c2.staticflickr.com/6/5663/22661333316_81fe1ab7da_c.jpg)
|
||||
|
||||
In this example, there are four different Java versions that are installed: OpenJDK JRE 1.6, Oracle Java JRE 1.6, OpenJDK JRE 1.7 and Oracle Java JRE 1.7. The default Java version is currently set to OpenJDK JRE 1.6.
|
||||
|
||||
If the necessary Java JRE is not installed, you can always install it using [these instructions][1].
|
||||
|
||||
Now that there are suitable candidates to change to, you can **switch the default Java version** among available Java JREs by running the following command:
|
||||
|
||||
$ sudo update-alternatives --config java
|
||||
|
||||
When prompted, select the Java version you would like to use. In this example, we choose Oracle Java JRE 1.7.
|
||||
|
||||
![](https://c2.staticflickr.com/6/5651/22066181083_b9c4c5b676_c.jpg)
|
||||
|
||||
Now you can verify the default Java version as follows.
|
||||
|
||||
$ java -version
|
||||
|
||||
![](https://c1.staticflickr.com/1/634/22499411280_1d702a4101_c.jpg)
|
||||
|
||||
Finally, if you defined JAVA_HOME environment variable somewhere, update the variable according to the newly set default Java version.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/change-default-java-version-linux.html
|
||||
|
||||
作者:[Dan Nanni][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://ask.xmodulo.com/author/nanni
|
||||
[1]:http://ask.xmodulo.com/install-java-runtime-linux.html
|
@ -0,0 +1,91 @@
|
||||
Linux FAQs with Answers--How to find which shell I am using on Linux
|
||||
================================================================================
|
||||
> **Question**: I often change between different shells at the command line. Is there a quick and easy way to find out which shell I am currently in? Also how can I find out the version of the shell?
|
||||
|
||||
### Find out Which Shell You are In ###
|
||||
|
||||
There are different ways to tell what shell you are currently in. The easiest way to find that out is by using special shell parameters.
|
||||
|
||||
For one, [a special parameter named "$$"][1] denotes the PID of the current instance of the shell you are running. This parameter is read-only and cannot be modified. So the following command will also show you the name of the shell you are running:
|
||||
|
||||
$ ps -p $$
|
||||
|
||||
----------
|
||||
|
||||
PID TTY TIME CMD
|
||||
21666 pts/4 00:00:00 bash
|
||||
|
||||
The above command works across all available shells.
|
||||
|
||||
If you are not using csh, another way to find out the current shell is to use an special shell parameter called "$$", which denotes the name of the shell or shell script that is currently running. This is one of the Bash special parameters, but available in other shells as well, such as sh, zsh, tcsh or dash. Using echo command to print out its value will tell you the name of the shell you are currently in.
|
||||
|
||||
$ echo $0
|
||||
|
||||
----------
|
||||
|
||||
bash
|
||||
|
||||
Don't be confused with a separate environment variable called $SHELL, which is set to the full path to your default shell. As such, this variable is not necessarily point to the current shell you are using. For example, $SHELL remains the same even if you invoke a different shell within a terminal.
|
||||
|
||||
$ echo $SHELL
|
||||
|
||||
----------
|
||||
|
||||
/bin/shell
|
||||
|
||||
![](https://c2.staticflickr.com/6/5688/22544087680_4a9c180485_c.jpg)
|
||||
|
||||
Thus to find out the current shell, you should use either $$ or $0, but not $SHELL.
|
||||
|
||||
### Find out the Version of the Shell You are Using ###
|
||||
|
||||
Once you know which shell you are in, you may want to find out what version of the shell it is. For that, type the name of your shell followed by "--version" at the command line. For example:
|
||||
|
||||
**For** bash **shell**:
|
||||
|
||||
$ bash --version
|
||||
|
||||
----------
|
||||
|
||||
GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
|
||||
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later
|
||||
|
||||
This is free software; you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
**For** zsh **shell**:
|
||||
|
||||
$ zsh --version
|
||||
|
||||
----------
|
||||
|
||||
zsh 5.0.7 (x86_64-pc-linux-gnu)
|
||||
|
||||
**For** tcsh **shell**:
|
||||
$ tcsh --version
|
||||
|
||||
----------
|
||||
|
||||
tcsh 6.18.01 (Astron) 2012-02-14 (x86_64-unknown-linux) options wide,nls,dl,al,kan,rh,nd,color,filec
|
||||
|
||||
For some shells, you can also use shell-specific variables (e.g., $BASH_VERSION or $ZSH_VERSION).
|
||||
|
||||
$ echo $BASH_VERSION
|
||||
|
||||
----------
|
||||
|
||||
4.3.8(1)-release
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/which-shell-am-i-using.html
|
||||
|
||||
作者:[Dan Nanni][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://ask.xmodulo.com/author/nanni
|
||||
[1]:http://ask.xmodulo.com/process-id-pid-shell-script.html
|
@ -0,0 +1,61 @@
|
||||
Linux FAQs with Answers--How to install Ubuntu desktop behind a proxy
|
||||
================================================================================
|
||||
> **Question**: My computer is connected to a corporate network sitting behind an HTTP proxy. When I try to install Ubuntu desktop on the computer from a CD-ROM drive, the installation hangs and never finishes while trying to retrieve files, which is presumably due to the proxy. However, the problem is that Ubuntu installer never asks me to configure proxy during installation procedure. Then how can I install Ubuntu desktop behind a proxy?
|
||||
|
||||
Unlike Ubuntu server, installation of Ubuntu desktop is pretty much auto-pilot, not leaving much room for customization, such as custom disk partitioning, manual network settings, package selection, etc. While such simple, one-shot installation is considered user-friendly, it leaves much to be desired for those users looking for "advanced installation mode" to customize their Ubuntu desktop installation.
|
||||
|
||||
In addition, one big problem of the default Ubuntu desktop installer is the absense of proxy settings. If your computer is connected behind a proxy, you will notice that Ubuntu installation gets stuck while preparing to download files.
|
||||
|
||||
![](https://c2.staticflickr.com/6/5683/22195372232_cea81a5e45_c.jpg)
|
||||
|
||||
This post describes how to get around the limitation of Ubuntu **installer and install Ubuntu desktop when you are behind a proxy**.
|
||||
|
||||
The basic idea is as follows. Instead of starting with Ubuntu installer directly, boot into live Ubuntu desktop first, configure proxy settings, and finally launch Ubuntu installer manually from live desktop. The following is the step by step procedure.
|
||||
|
||||
After booting from Ubuntu desktop CD/DVD or USB, click on "Try Ubuntu" on the first welcome screen.
|
||||
|
||||
![](https://c1.staticflickr.com/1/586/22195371892_3816ba09c3_c.jpg)
|
||||
|
||||
Once you boot into live Ubuntu desktop, click on Settings icon in the left.
|
||||
|
||||
![](https://c1.staticflickr.com/1/723/22020327738_058610c19d_c.jpg)
|
||||
|
||||
Go to Network menu.
|
||||
|
||||
![](https://c2.staticflickr.com/6/5675/22021212239_ba3901c8bf_c.jpg)
|
||||
|
||||
Configure proxy settings manually.
|
||||
|
||||
![](https://c1.staticflickr.com/1/735/22020025040_59415e0b9a_c.jpg)
|
||||
|
||||
Next, open a terminal.
|
||||
|
||||
![](https://c2.staticflickr.com/6/5642/21587084823_357b5c48cb_c.jpg)
|
||||
|
||||
Enter a root session by typing the following:
|
||||
|
||||
$ sudo su
|
||||
|
||||
Finally, type the following command as the root.
|
||||
|
||||
# ubiquity gtk_ui
|
||||
|
||||
This will launch GUI-based Ubuntu installer as follows.
|
||||
|
||||
![](https://c1.staticflickr.com/1/723/22020025090_cc64848b6c_c.jpg)
|
||||
|
||||
Proceed with the rest of installation.
|
||||
|
||||
![](https://c1.staticflickr.com/1/628/21585344214_447020e9d6_c.jpg)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/install-ubuntu-desktop-behind-proxy.html
|
||||
|
||||
作者:[Dan Nanni][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://ask.xmodulo.com/author/nanni
|
Loading…
Reference in New Issue
Block a user