How do I tell if I am using 64-bit Eclipse and 64-bit JVM on my Linux machine?
To verify that you are using 64-bit JVM:
java -d64 -version
In a comment above you say that you're using a software package that requires "such constraints". I'm not exactly sure what you mean by that, but for Java programs, it doesn't matter if the underlying Java implementation is 32-bit or 64-bit (well, as long as it doesn't need a huge amount of memory, for example). A normal Java program should run the same, no matter if it runs on a 32-bit or 64-bit OS.
java -version should give you an indication if your Java runtime environment is 32-bit or 64-bit.
Eclipse contains some native binaries (for the SWT libraries). Depending on if your Java runtime environment is 32-bit or 64-bit, you need a version of Eclipse with the corresponding native binaries. The Eclipse download page contains links for 32-bit and 64-bit Linux versions of Eclipse.
Note: If your OS is 64-bit but your Java RE is 32-bit, you will still need the 32-bit Eclipse.
Usually you can tell from your eclipse.sh or your eclipse.ini if you are using 32bit or 64bit version, as the involved plugins are quite different.
As for the JVM, are you running Eclipse with something other than your default JVM? 'which java' usually tells you what you're using as your java executable.
Related
I need to run java in 32 bit mode under windows 8.1 64 bit.
I have installed java 7 jre under c:\Program Files\Java\jre7 (64bit JVM) and under c:\Program Files (x86)\Java\jre7 (32bit JVM).
However, if from cmd I issue java -d32 -version, I get this error:
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
Without the -d32 switch it confirms its running the 64 bit JVM:
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
So I opened the java control panel and added the 32bit JVM to the user installed JRE (system tab does not allow me to change anything even if running as administrator), but nothing changes.
I've read some posts of users saying that with java 7+ the -d32 mode should be supported but I can't get it.
Note: Please note that I cannot remove the 64bit JVM because I need it for other applications
According to this FAQ :
How do I select between 32 and 64-bit operation? What's the default?
The options -d32 and -d64 have been added to the Java launcher to
specify whether the program is to be run in a 32 or 64-bit
environment. On Solaris these correspond to the ILP32 and LP64 data
models, respectively. Since Solaris has both a 32 and 64-bit J2SE
implementation contained within the same installation of Java, you can
specify either version. If neither -d32 nor -d64 is specified, the
default is to run in a 32-bit environment. Other Java commands
(javac, javadoc, etc.) will rarely need to be executed in a 64-bit
environment. However, the -d32/-d64 options may be passed to these
commands and then on to the Java launcher using the established -J
prefix option (eg: -J-d64).
All other platforms (Windows and Linux) contain separate 32 and 64-bit installation packages. If both packages are installed on a
system, you select one or the other by adding the appropriate "bin"
directory to your path. For consistency, the Java implementations on
Linux accept the -d64 option.
I've found another solution to that.
By using launchj4 I can wrap my jar into an exe and I can specify the JRE I want to use and force it to search for a 32bit JVM, set min and max version etc (see the JRE).
The wrapper will automatically search installed JRE's and chose the one that meets the requirements.
Also wrapping my jar into an exe is more convenient for deploying my application.
You can have both 32bit and 64 bit installed on the same machine. Infact you can have multiple version of each of 32bit and 64bit installed (eg - java6 and java7). Because each JRE will be installed in different folders, it usually does not matter.
When running different versions of jre, your application will search for the Java executable using the PATH variable. So if Java 32bit is first on the PATH, you will have problems running a Java 64bit application. You can modify the path to use a certain Java version e.g. by defining a environment variable JAVA32HOME with the value C:\java\java6 (32bit) and change the command to
%JAVA32HOME%\bin\java ...
Or you can manually add the version you want to use, first in the PATH variable. Remember the first instance of java.exe found while searching your PATH will be the one that is executed.
Why don't you just install the 32-bit version of Java as well from the link below:
Java Downloads for All Operating Systems
Consider going to your settings , choosing your active profile then click on advanced settings , now on the menu that pops up and choose the version you would like to work with . Once everything is configured use the terminal to verify the usage of the right version. Now incaqse thus pdate-alternatives --config java. through the terminal and update any values by selecting the version you like and pressing down on the enter key on the output you get
I am attempting to use a 3rd-party dll for a program I am writing in java. Unfortunately, it only has 32-bit support. When I attempt to load the dll in a 64-bit VM, I get the following error:
Can't load IA 32-bit .dll on a AMD 64-bit platform
I have tried running in a 32-bit VM, which works in eclipse, but when I export the project, I get the same error. Please help!
Sincerely, Ben
You cannot use a 32-bit DLL in a 64-bit Hotspot JVM. It won't work. And I don't know of any other 64-bit JVM that supports 32-bit DLLs.
Indeed, as Peter Lawrey points out, this is not just a JVM limitation. No mainstream operating system allows an application running in 64-bit mode to load and use a 32-bit library.
Your choices are:
Switch to a 32-bit JVM. (You can run a 32bit JVM on a 64-bit OS ...)
Port the DLL to 64-bit.
Switch to an alternative library that is pure Java, or has a 64-bit DLL.
I have tried running in a 32-bit VM, which works in eclipse, but when I export the project, I get the same error.
That can only mean that you are running a 32-bit JVM to run the application within Eclipse, and a 64-bit JVM to run the application outside of Eclipse. (The issue is how you run the application, not how you export it ...)
The only way to use a 32-bit shared library from a 64-bit JVM is to run an additional 32-bit JVM and access it via RMI, JMS or some form of messaging.
Its an intrinsic limitation of 64-bit programs (not just Java) that it cannot exchange pointers with a 32-bit library.
From my experience with Windows 7 (64-bit) and Java, a 32-bit JRE uses less memory and runs significantly faster than a 64-bit JRE (provided you don't need or benefit from having a lot of memory). I imagine the same thing is true for Mac OSX (and other platforms) as well.
I am currently running OSX Lion (v10.7), and I have installed the standard Java app. Under Java Preferences, I see "Java SE 6" from "Apple Inc." for both CPU-types "32-bit" and "64-bit" version "1.6.0_26-b03-383". I have changed the preferred order to put the 32-bit version on top of the 64-bit version, hoping that this would make the 32-bit version default.
But "java -version" still says:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511c)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)
Is it possible to use the 32-bit version by default? And how?
Also, does anyone have experiences / comparative measurements regarding speed and memory efficiency between the 32/64-bit versions?
I found out now, that the 32-bit JVM can be explicitly launched using the -d32 switch.
On my machine, "java -version -d32" says:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511c)
Java HotSpot(TM) Client VM (build 20.1-b02-383, mixed mode)
and although it doesn't say so, it is a 32-bit JVM.
The latest versions of Java 64-bit have -XX:+UseCompressedOops on by default (if your heap is less than 32 GB). This means 32-bit references are used in any case. The objects are still slightly bigger (4 bytes more overhead)
This article compares 32-bit, 64-bit with UseCompressedOops Java: How much memory do different arrays and collections consume
In terms of performance, I have found it to be 5-10% depending on what you are doing. If you are using a lot of long values it will be faster to use 64-bit.
Go into the "Java Preferences" App and drag java 32 bit to the top of the list.
Try the below steps:
Open terminal and go to /System/Library/Frameworks/JavaVM.framework/Versions/
Type ls -l to list all available Java versions
Enter sudo ln -fhsv CurrentJDK
Reference: Changing Java Version
in /System/Library/Frameworks/JavaVM.framework/Versions
I found version 1.6 installed and changed the path for java,javac to point to
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/home using environment
alias rather than the default link found in /usr/bin/
I had setup 64-bit eclipse with 64-bit JRE. I wanted to try QuickTime for Java but I realized that it is not compatible with 64-bit JRE. One option I have is to change over to 32-bit eclipse as well as 32-bit JRE. But I was wondering if same 64-bit Eclipse can be used along with 32-bit JRE also.
Please suggest!
EDIT: I guess I was not clear enough in my question. I do understand that I will need to use a 64-bit JRE to run 64-bit Eclipse. I only wanted to make sure that I can have a project in 64-bit Eclipse which uses a 32-bit JRE for execution.
Just include the 32bit JRE as an additional Java runtime in the configuration and use it for your project.
You cannot use 64-bit Eclipse with 32-bit JRE, but you can have both 32-bit and 64-bit JREs installed on your system. If you find that one or the other Eclipse fails to start in this situation, it is likely finding the wrong JRE. To remedy the situation, add the following lines to the start of your eclipse.ini file:
-vm
[fullpath]\javaw.exe
First, you need create a 32bit jre environment in menu windows/preferences/java/installed jres. Then, you can create a java project and select 32bit jre environment for 32bit java program.
I'm running 64-bit version of Vista on my notebook with 4G of RAM, the Ram is maxed out at 1.5G on the 32-bit version of Java. But if I move completely to 64-bit version of Java, the JDIC part won't work, so my question is : if I install both 32 and 64 bit versions of Java, can Netbeans easily switch between the two ? So if I run out of ram at 1.5G, I switch to the 64-bit, but if I need to develop JDIC part, I switch back to the 32-bit, is this possible with Netbeans ?
========================================================================
I've just realized I asked half a question, since which version(32/64 bit) of Netbeans also matters. So my question should be : If I run 64-bit of Neatbeans(assume it's available), and have both versions of Java installed, can I switch between the two Java versions for my projects in Netbeans ?
NetBeans does work with both 64-bit and 32-bit JVM. Eclipse can only work with 32-bit JVM. I have a script for launching Eclipse with installed 32-bit JVM and NetBeans for the 64-bit or 32-bit JVM.
You cannot switch JVMs in a running app. You'll have to restart it, but you should certainly be able to run Netbeans in both JVMs.