fail to update jdk1.7.0_45 in raspberry pi

2019-08-10 12:10发布

问题:

I'm developing the TV Scoreboard app with the use of window laptop and raspberry pi. I'm using the putty to have socket connection.

Before that it request to state the X11 server variable, so I have installed the Xming server in my window laptop and fixed to localhost:0.0.0.0

But JFLauncher keep pop up the message to install the newest Java Runtime. So I think the latest and suitable one should be jre 1.7.0_45.

I have download the ejre-7u45-fcs-b15-linux-arm-vfp-hflt-client_headless-26_sep_2013

 mkdir java
    cd java
    tar zxvf *.gz

after unpack, I remove the rar file.

./bin/java -version

it show the latest version but if I just

java -version

it show the old version detail.

what should I do to update it to the latest version? Any mistake for my steps?

回答1:

but if i just java -version it show the old version detail.

When you run this command from your command line, the PATH environment variable is what the shell will evaluate to determine how to disambiguate your command. If you don't ensure that the new java binary location is in your PATH, and has a higher precedence than the old one, then the shell has no way of knowing to execute your new java.

Try the following:

$which java //tells you which java command the shell will execute
$echo $PATH //shows you what directories are in your path
$export PATH=/my/new/java/bin/directory:$PATH //set your new java into the PATH env
$java -version

See this tutorial on setting PATH.