0

I just entered command like this.

stillily@ubuntu:~$ cd Desktop/
stillily@ubuntu:~/Desktop$ cd jdk1.8.0_51/
stillily@ubuntu:~/Desktop/jdk1.8.0_51$ cd bin/
stillily@ubuntu:~/Desktop/jdk1.8.0_51/bin$ ls
appletviewer  jar        javadoc         javapackager  jconsole  jhat  jmc         jsadebugd  jvisualvm     pack200     rmiregistry  tnameserv  xjc
ControlPanel  jarsigner  javafxpackager  java-rmi.cgi  jcontrol  jinfo  jmc.ini     jstack     keytool       policytool  schemagen    unpack200
extcheck      java       javah           javaws        jdb       jjs    jps         jstat      native2ascii  rmic        serialver    wsgen
idlj          javac      javap           jcmd          jdeps     jmap   jrunscript  jstatd     orbd          rmid        servertool   wsimport
stillily@ubuntu:~/Desktop/jdk1.8.0_51/bin$ java
The program 'java' can be found in the following packages:

And it confused me a lot that just this morning I can run java correctly.

Stillily
  • 39
  • 1
  • 9

1 Answers1

1

You are trying to use a downloaded version of Java, not a system wide install. This means you need to prefix the command with a path:

$ ./java # when you're in the bin directory
$ ~/Desktop/jdk1.8.0_51/bin/java # from anywhere else

I would recommend just installing OpenJDK with apt-get though.

Anonymous
  • 11,740
  • 3
  • 40
  • 50
  • I'm sorry to have asked a foolish question ;_; ! Tonight my head was not clear...as soon as I posted it I found that I was wrong – Stillily Jul 17 '15 at 16:19