Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com 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

2 Answers 2

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:

NEVER EVER MAKE JAVA WRITABLE TO USERS

 -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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.