7

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

Randnum
  • 1,360
  • 4
  • 32
  • 48
  • Are you sure `"sun.arch.data.model` gives JVM architecture and not OS architecture. I am a little unclear on this concept. – RanRag Jan 24 '12 at 18:03
  • That I am not sure of. I got that off of another stack overflow thread. but will double check that now – Randnum Jan 24 '12 at 18:10
  • Are you running the 64 bit version of Eclipse? I'm pretty sure that Eclipse will select the proper JVM based on its version, and since Eclipse ships JNI, you can't mix-and-match 32 and 64 bit Eclipse/JVM installs. – Edward Thomson Jan 24 '12 at 18:38
  • This might be my problem but because I've changed everything to make it say use the 64 bit jvm. It doesn't make since that just because eclipse is running in 32 bit it would force its programs to do so also. – Randnum Jan 24 '12 at 21:23
  • 1
    @Randnum: eclipse uses a bunch of JNI, so if you've got the 32 bit Eclipse, it will have to run the 32 bit JVM so that it can run its 32 bit JNI. Or else it, too, would have the problem that you're describing above. – Edward Thomson Jan 24 '12 at 22:38
  • The JNI is not unique to eclipse though it's a took from the JDK which is 64bit. Whine I run a "file eclipse" it tells me that it is a 64 bit version unless just the link 64 bit. I'm not sure how I could tell definiteivly which version I'm running. – Randnum Jan 24 '12 at 22:43
  • I'm going to try and install a 64 bit version that I know is 64 bit and take the 2 days to import everything and all my project and glassfish over. Hopefully that fixes the problem. I'm 90% sure that my current eclipse IS 64 bit though. – Randnum Jan 24 '12 at 22:43
  • 1
    @Randnum: look in the `plugins` directory of your Eclipse install. You should see `org.eclipse.swt.gtk.linux.platform_version.jar`. This file will indicate what version you're running. – Edward Thomson Jan 24 '12 at 22:58
  • Thanks and I think I fixed at least a partial problem by changing the JRE to point to another 64 bit one. I'm not sure why it recognizes this runtime as 64 and not the other but that prints 64 when I check. I'm still having the same unresolved link error though with my JNI program. but that can be a new questions. – Randnum Jan 24 '12 at 23:20
  • @EdwardThomson looks like I have two of those jars one says x86_64_3.7.1.v3738a.jar and the other is x86_3.7.1.v3838a.jar – Randnum Jan 24 '12 at 23:57

7 Answers7

3

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"

Chris Nava
  • 6,614
  • 3
  • 25
  • 31
  • 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. – Chris Nava Jan 24 '12 at 22:50
  • 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 Jan 24 '12 at 22:54
  • @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. – ee. Jan 25 '12 at 03:16
  • Open the Run Configurations... of your project and check the runtime configured there. – Chris Nava Jan 25 '12 at 04:35
1

In eclipse.ini add:

-Xmx8g
-d64
Sergei Krivonos
  • 4,217
  • 3
  • 39
  • 54
0

Okay. This has been rather headache inducing, but I believe I have a solution. After changing the eclipse.ini, Go to your project properties. Under the Run/Debug settings, edit the launch configuration for your project. Under the JRE tag, click installed JREs. When that dialog comes up, click search. Go to your program files folder, NOT the x86 one, and let it search for your JREs. When the latest comes up, deselect the JRE that was currently selected and select the most recent JRE that it found. I renamed mine JRE7-64 just so I could identify a difference. This solved the issue on my end. Good luck

David
  • 1
0

I think there is a bug in the Run Configuration page.

I had to add the 64-bit JRE in run configuration, select it, and DELETE the 32-bit entry (even though it was already deselected).

eclipse.ini didn't work for me.

This is Eclipse Luna.

Keegan Jay
  • 960
  • 2
  • 10
  • 18
0

For me its working properly! . Make sure your path is c:\Program File not c:\Program File(X86) ( if you installed 64 bit JDK it should store in c:\ Program Files)

invariant
  • 8,758
  • 9
  • 47
  • 61
0

Eclipse configuration is explained here

Peter Svensson
  • 6,105
  • 1
  • 31
  • 31
0

The "installed JREs" (better use JDKs) are used for building and running your code and can be of different architecture or Java version. The JVM used for running Eclipse is defined in the eclipse.ini file. You should use the version for the architecture of the JVM.

Hauke Ingmar Schmidt
  • 11,559
  • 1
  • 42
  • 50
  • 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. – Randnum Jan 24 '12 at 21:13
  • 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? – Hauke Ingmar Schmidt Jan 24 '12 at 21:25
  • 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 Jan 24 '12 at 22:12
  • There is something with Eclipse that is screwing it up. – Randnum Jan 24 '12 at 22:12
  • 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. – Hauke Ingmar Schmidt Jan 24 '12 at 22:46
  • 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. – Randnum Jan 24 '12 at 22:56
  • 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`. – Hauke Ingmar Schmidt Jan 25 '12 at 09:28
  • Then how do you specify the JVM? – Randnum Jan 25 '12 at 15:14