当前位置: 动力学知识库 > 问答 > 编程问答 >

why can't I run java in ubuntu even with these commands?

问题描述:

I just entered command like this.

[email protected]:~$ cd Desktop/

[email protected]:~/Desktop$ cd jdk1.8.0_51/

[email protected]:~/Desktop/jdk1.8.0_51$ cd bin/

[email protected]:~/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

[email protected]:~/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.

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: