jdk - Eclipse says "Access Denied" when running javaw and how to fix it?

24
2014-05
  • Eduardo de Luna

    I'm trying to get Eclipse to compile and run a HelloWorld class but it can't even do that. I have installed Eclipse x86 SDK 4.2.0 together bit with the latest JRE and JDK both in 64 bit as well. I also have the PATH variables set to respond to command prompts. When I try to run the following code:

    class HelloWorld {
        public static void main(String[] args)
            {
                System.out.println("Hello World!" ) ; 
        }
    }
    

    And it returns the following error:

    Exception occurred executing command line. Cannot run program "C:\Program Files\Java\jre7\bin\javaw.exe" (in directory "C:\Users\Default\workspace\devs"): CreateProcess error=5, Access is denied.

    Can you help me fix this? Thanks!

  • Answers
  • vahissan

    You have to add the following entry to your eclipse.ini file:

    -vm
    C:/Prog/Java/jdk1.6.0_21/jre/bin/server/jvm.dll
    

    Make sure you replace the version number with yours and backup the original eclipse.ini file in case of trouble and copy the lines above into the file BEFORE the --vmargs argument. If not, Eclipse will crash.

    Follow this link for more information: http://www.eclipse.org/forums/index.php?t=msg&goto=559997&S=a4836b4add35f1ac144df946cb1ef64d


  • Related Question

    Failed to load the JNI shared library on starting Eclipse
  • Jonas

    I downloaded the latest version of Eclipse, but I can not start it.

    The error message I get is:

    Failed to load the JNI shared library "C:\Program Files (x86)\Java\jdk1.6.0_20\bin..\jre\bin\client\jvm.dll".

    How do I fix this?

    I use 64-bit Windows, 32-bit JDK, and downloaded 64-bit Eclipse.


  • Related Answers
  • Steffen Opel

    This usually happens if you have a 32- vs. 64-bit mismatch between the installed JDK and Eclipse versions!

    Your version of Eclipse is trying to access a 32-bit JDK (as indicated by C:\Program Files (x86)), but either fails because Eclipse is expecting a 64-bit JDK or because the 32-bit JDK is missing - consequently you'll need to make sure to match the Eclipse and JDK versions bit wise accordingly.

  • jayesh kavathiya
    -startup
    plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
    -product
    org.eclipse.epp.package.java.product
    --launcher.defaultAction
    openFile
    --launcher.XXMaxPermSize
    256M
    -showsplash
    org.eclipse.platform
    -vm
    C:/Program Files/Java/jdk1.6.0_32/jre/bin
    --launcher.XXMaxPermSize
    256m
    --launcher.defaultAction
    openFile
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xms40m
    -Xmx512m
    

    use eclipse and os both 64 bit or both 32 bit

  • digitxp

    I had installed both JDK and Eclipse 64-bit versions, but had the same issue...

    Finally I discovered that my %PATH% system variable didn't include the folder. Don't forget to change it to the correct folder where your JDK\bin is installed. Worked for me.

  • Simon Sheehan

    On Windows 7 you have the chance to use symbolic links as under unix.

    So with cmd (run as an admin), run the following: mklink /d jdk jdk-versionnr-etc you don't need to update your path, JAVA_JOME the next time you update Java !

  • Community

    I had a 64 bit Eclipse and 32 bit Java and had the same issue. After installing 64 bit Java and updating system path, no issues.

  • Ivo Flipse

    If you have downloaded 64-bit Eclipse and a 64-bit JDK/JRE, check the availablity of javaw.exe for 64-bit.

    In my case it was in C:\Program Files\Java\jre6\bin

    I have extracted Eclipse to the c:\eclipse folder; within that the eclipse.ini file is available. Replace the contents of that file with the following:

    -showsplash
    org.eclipse.platform
    --launcher.XXMaxPermSize
    256M
    -vm
    C:\Program Files\Java\jre6\bin\javaw.exe
    -framework
    plugins\org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xmx700m
    -XX:MaxPermSize=690M
    

    Leave the new line in between the -vm flag and the value. It worked for me.

  • Kevin Panko

    I was facing same issue even though I had 64-bit versions of both JDK and Eclipse. I found out that the JDK path was missing in eclipse.ini.

    So I added following lines in eclipse.ini file:

    -vm
    C:\Program Files\Java\jdk1.7.0_45\jre\bin <this might be different on your machine>
    

    This solved the problem! :-)

  • Vivek Vermani

    If eclipse is 64 bit , update Java in Path to C:\Program Files\Java\jre7

    or else

    check the Java location being referred by eclipse and copy the content C:\Program Files\Java\jre7 to eclipse jre location.

    Reference - http://www.buggybread.com/2013/01/failed-to-load-jni-shared-library.html