java command not found

INSTALLATION PROCEDURE ON RASPBERRY PI

The remaining steps should be performed directly on the console of the Raspberry Pi or using a SSH terminal connection with shell access.  In the last step, we transfered the Oracle JDK file to the "pi" user‘s home directory.  We should be logged in as the "pi" user and already in the user‘s home directory.

Lets create a new directory where we will install the JDK files to.

sudo mkdir -p -v /opt/java

Next, lets unpack the Oracle JDK .gz file using this command

tar xvzf ~/jdk-7u10-linux-arm-sfp.gz

The unpacking process will take a few seconds to complete.  It unpacks all the contents of the Oracle JDK tz file to a new directory named "jdk1.7.0_10" located in the user‘s home directory.

With the unpack complete its now time to move the new unpacked directory to the Java install location that we created earlier under "opt/java".

sudo mv -v ~/jdk1.7.0_10 /opt/java

We can also delete the original .tz file as it is no longer needed

rm ~/jdk-7u10-linux-arm-sfp.gz

To complete the JDK installation we need to let the system know there is a new JVM installed and where it is located.  Use the following command to perform this task.

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.7.0_10/bin/java" 1

And finally we also need to tell the system that we want this JDK to be the default Java runtime for the system. The following command will perform this action.

sudo update-alternatives --set java /opt/java/jdk1.7.0_10/bin/java

Now java is installed.  To test and verify we can execute the java command using the version argument.

java -version

You should get the following response:

That‘s it the Oracle JDK is installed and ready for use.

ADD JAVA_HOME ENVIRONMENT VARIABLE

Some Java programs require a JAVA_HOME environment variable to be configured on the system.  Add the following line to you "/etc/environment" using your favorite text editor.

JAVA_HOME="/opt/java/jdk1.7.0_10"

Also, edit your "~/.bashrc" file using this command

nano ~/.bashrc

and add the following two lines to the bottom of the file and save.

export JAVA_HOME="/opt/java/jdk1.7.0_10"export PATH=$PATH:$JAVA_HOME/bin 

Reboot or re-login to apply the export to your environment.

------------------------------------------------------------------------

att:

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/javak1.7.0_10/bin/java" 1

              --install <link> <name> <path> <priority>

时间: 2024-08-17 03:41:47

java command not found的相关文章

-bash: java: command not found 解决方法

-bash: java: command not found 在卸载jdk之后,会报错 就是配置环境变量出了问题, JAVA_HOME=/usr/java/jdk1.8.0_25 PATH=$PATH:$JAVA_HOME/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar export  JAVA_HOME  PATH  CLASS

Wrapper: Error - Unable to execute Java command

在64位的系统下 将短信程序运行于服务中,出现以下错误: Error: [size=14px; line-height: 26px;]FATAL  | wrapper  | 2012/06/18 17:13:29 |   There may be a configuration problem: please check the logs.[/size] [size=14px; line-height: 26px;]FATAL  | wrapper  | 2012/08/04 12:07:51

bash: java: command not found

[[email protected] ~]# java -version -bash: java: command not found 出现上面问题,解决方法: [[email protected] ~]# source /etc/profile 最后在测试是否安装成功: [[email protected] ~]# java -version java version "1.8.0_241" Java(TM) SE Runtime Environment (build 1.8.0_2

LINUX -bash java command not found

Linux系统是由于设置JAVA环境变量时设置PATH属性导致command not found错误,PATH属性设置如下: vi /etc/profile JAVA_HOME=/usr/java/jdk1.6.0_32 根据自己的安装路径修改PATH=$PATH:$JAVA_HOME/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.ja

Java之2.System.RunTime类

1. System  系统类 主要用于获取系统的属性数据. System类常用的方法: arraycopy(Object src, int srcPos, Object dest, int destPos, int length) 一般 src - 源数组. srcPos - 源数组中的起始位置. dest - 目标数组. destPos - 目标数据中的起始位置. length - 要复制的数组元素的数量. currentTimeMillis()  获取当前系统系统.       重点 exi

java调试工具jdb

Finds and fixes bugs in Java platform programs. Synopsis jdb [options] [classname] [arguments] options Command-line options. See Options. classname Name of the main class to debug. arguments Arguments passed to the main() method of the class. Descrip

java命令行

Launches a Java application. Synopsis java [options] classname [args] java [options] -jar filename [args] javaw [options] classname [args] javaw [options] -jar filename [args] options Command-line options separated by spaces. See Options. classname T

Java Service Wrapper配置详解

1 #encoding=UTF-8 2 # Configuration files must begin with a line specifying the encoding 3 # of the the file. 4 5 #******************************************************************** 6 # Wrapper License Properties (Ignored by Community Edition) 7 #*

The Invocation API(转,在C++中调用Java)

转载自:http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html Chapter   5 The Invocation API allows software vendors to load the Java VM into an arbitrary native application. Vendors can deliver Java-enabled applications without