Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Ubuntu 12.04, installed JDK and interestingly have the following error. Why do I have this error though java file exist in there?

appuser@securexmlgw-db:~/Downloads/jdk1.7.0_04/bin$ ls
appletviewer  javac         jcontrol    jstack        policytool   tnameserv
apt           javadoc       jdb         jstat         rmic         unpack200
ControlPanel  javah         jhat        jstatd        rmid         wsgen
extcheck      javap         jinfo       jvisualvm     rmiregistry  wsimport
idlj          java-rmi.cgi  jmap        keytool       schemagen    xjc
jar           javaws        jps         native2ascii  serialver
jarsigner     jcmd          jrunscript  orbd          servertool
java          jconsole      jsadebugd   pack200       test
appuser@securexmlgw-db:~/Downloads/jdk1.7.0_04/bin$ ./java -version
-bash: ./java: No such file or directory

I have given all exectable persission.

-rwxrwxrwx 1  500  500   5809 Apr 12  2012 jarsigner*
-rwxrwxrwx 1  500  500   5654 Apr 12  2012 java*
-rwxrwxrwx 1  500  500   5805 Apr 12  2012 javac*
-rwxrwxrwx 1  500  500   5809 Apr 12  2012 javadoc*
share|improve this question

migrated from Dec 6 '12 at 19:14

This question came from our site for professional and enthusiast programmers.

Because it's not executable. – Brian Roach Dec 6 '12 at 8:24
No, It is given required permission of execution. – mmc18 Dec 6 '12 at 8:26
up vote 1 down vote accepted

Most likely, you have downloaded a 32-bit JRE and are running it on a 64-bit platform without emulation libraries. Simply download the one matching your platform, instead.

The kernel returns ENOENT on exec when it cannot find the ELF interpreter the executable specifies.

share|improve this answer
To confirm this, compare the outputs of uname -m with the information returned by file java. It's likely the uname output confirms you are 64-bit and the file output confirms the file is compiled for 32-bit. – Duncan Jones Dec 6 '12 at 8:40
installation of jdk-6u29-linux-x64.bin has solved the problem. Thnaks. – mmc18 Dec 6 '12 at 8:54
@mmc18 now uninstall it again, so you don't screw up the permissions, and install the Ubuntu openjdk package instead. So you get automatic security updates. – Anony-Mousse Dec 6 '12 at 8:56

Any chance that you are not on a native file system, but e.g. a FAT (Windows) filesystem?

If so, execute permissions are supposed to not work, as the filesystem does not have proper permission support. This is called noexec, and I recommend not changing it. Otherwise, you open doors for hackers.

Use Ubuntu openjdk-7. It is much better supported than the Oracle version:

You only get automatic security updates if you use the packaged version.

One more thing:


 -rwxrwxrwx 1  500  500   5654 Apr 12  2012 java*

this says "any user may modify (=hack, virus infect etc.) your java". DON'T DO THIS. Keep write permissions under the tightest control possible.

share|improve this answer
If that were the problem, he'd be getting either EACCES or EPERM, not ENOENT. – Dolda2000 Dec 6 '12 at 8:57
@Dolda2000 well spotted. Anyway, his installation is badly screwed... – Anony-Mousse Dec 6 '12 at 8:58
It is just for testing in order to find why it is not executable. Normally you are right that such permission should not be given. :) – mmc18 Dec 6 '12 at 9:01
I have never ever heard that write permissions would be necessary for execution, in particular not when there is an execute bit. – Anony-Mousse Dec 6 '12 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .