How to reconfigure eclipse to use a 64 bit JVM

23,125

Solution 1

Add the -vm tag to eclipse.ini or the shortcut to explicitly specify a JRE. Note that the default for Windows XP is to use the CRAPPY JRE that comes with Windows.

-vm "%JAVA_HOME%/bin/javaw.exe"

Solution 2

In eclipse.ini add:

-Xmx8g
-d64
Share:
23,125
Randnum
Author by

Randnum

Updated on July 09, 2022

Comments

  • Randnum
    Randnum almost 2 years

    I'm using eclipse on what I thought were all 64 bit runtime environments. The current settings Java>installed JREs and Execution Environment all point to jdk1.6.0_30 which is a 64 bit version of the JDK. However, eclipse still thinks it's running a 32 bit version because when I run:

    System.getProperty("sun.arch.data.model");

    it returns 32 instead of 64.

    And the external JNI resource that I compiled for 64 bit machines will not link to the shared .so file unless it's running in a 64 bit enviroment. (I'm getting word size mismatch errors when I try to do this)

    So How can I reconfigure eclipse to run 64 bit jvm. Does eclipse itself have to be a 64 bit version?

    :on linux

    Edit: I have tried everyone's suggestions and nothing is working. I've changed the execution, and enviroment variables to point to the newst JDK I have which is 1.6_30. when I run the program from a command line I get 64 and amd64 as the value when I run the same program in eclise I get 32 and i386. Something is wrong in eclipse that is causing it to try and run it on a 32 bit JVM. when I try java -d32 -version it says that a 32 bit enviroment isn't installed but Eclipse doesn't know that. I've modified the Eclipse.ini file and still nothing is working. I've restarted eclipse after these changes...nothing. Can some one who knows eclipse well people help me out here. thanks

  • invariant
    invariant over 12 years
    sorry i don't have idea about linux.
  • Randnum
    Randnum over 12 years
    This is weird because I don't think my computer has a 32 bit JDK/JRE installed on the computer as far as I know. I've specified the runtime environments everywhere including in the Eclipse.ini file and it still thinks it's running on a 32 bit computer.
  • Hauke Ingmar Schmidt
    Hauke Ingmar Schmidt over 12 years
    What flavour of Linux are you using? Some install extra JREs, e.g. for OpenOffice. How did you install the JRE? Did you change the execution environment in the project?
  • Randnum
    Randnum over 12 years
    I'm using Red Hat 5, I do have multple JDK's installed but I was carefull to change the classpath in linux to the newest one 1.6. I also changted all of the environment and execution variables in the project. In fact I don't know that I have a 32 bit jvm installed anywhere on my computer. For some reason Eclipse is going rogue and saying that it's on an i386 computer and that it is running in 32 bit mode. however when I go outside of eclipse and runt he exact same command it shows the correct 64 bits and an amd64 computer.
  • Randnum
    Randnum over 12 years
    There is something with Eclipse that is screwing it up.
  • Randnum
    Randnum over 12 years
    I have modified the ini and it did not work. It continues to show 32bit on a i386.
  • Hauke Ingmar Schmidt
    Hauke Ingmar Schmidt over 12 years
    Wait... how are you running the command 'System.getProperty("sun.arch.data.model");' inside Eclipse? Must be some project... and then the Eclipse runtime JRE is not relevant.
  • Chris Nava
    Chris Nava over 12 years
    Note that the format in eclipse.ini is to have -vm on one line and the value on the next.. I'm not sure why.
  • Randnum
    Randnum over 12 years
    yes, I did it correctly. it actually recognizes the new location that I put it but for some reason it's still in a 32bit mode even though the JDK/JRE it recognizes as correct. It's like there is a flag I have to switch somewhere
  • Randnum
    Randnum over 12 years
    Yes it is inside eclispse, although I've also tested it in vim/ from the command line and it shows up as 64 bit. So I know it's specific to eclipse. Eclipse is recognizing the JDK/JRE correctly because there is a system property you can test for that as well and it's working.
  • ee.
    ee. over 12 years
    @Randnum since you have said that you are using Linux, have you tried to run your Java program with VM argument -d64? On Oracle Java 1.6 version for Windows XP, the VM option -d32 and -d64 don't exist.
  • Chris Nava
    Chris Nava over 12 years
    Open the Run Configurations... of your project and check the runtime configured there.
  • Hauke Ingmar Schmidt
    Hauke Ingmar Schmidt over 12 years
    This way you are testing against the project configuration or the configured JREs, this has nothing to do with the JRE Eclipse is running with, so you don't need to tinker with eclipse.ini.
  • Randnum
    Randnum over 12 years
    Then how do you specify the JVM?
  • Augustin
    Augustin over 8 years
    Clarification: The -Xmx8g parameter tells Eclipse it can use up to 8 GB of RAM. This parameter is not really needed to make Eclipse use a 64-bit JVM.
  • Sergei Krivonos
    Sergei Krivonos over 6 years
    Clarification: -d64 is