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
Related
I am working on a legacy project with Glassfish 3 and Java 7. The problem is in order to run Eclipse, I need Java 8. When I install Java 8, I can no longer run Glassfish under Java 7 for some reason.
I do see the two JDKs in control panel for User tab in Java Runtime Environment Settings, but under System once I install Java 8, I only see Java 8 there. So it just runs under Java 8 from what I can tell.
This is my first week of Java.
Simply specify the needed JDK for your Glassfish domain:
Find this configuration file: C:\servers\glassfish\config\asenv.bat (this path is an example)
Edit the file, comment the previous JDK and add the wanted one:
REM set AS_JAVA=C:\Program Files\Java\jdk1.8\..
set AS_JAVA=C:\Program Files\Java\jdk1.7\..
When you install a new JVM, usually it sets itself as the default version on that platform which is the first one found on the Path environment variable. In order to find what version is the default one, run this command: java -version and the output will be something like:
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.10.2-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)
As you see in this case the default one is OpenJDK-8.
If you want to change that, you have to do some changes which depend on the platform can vary but usually you should:
Change JAVA_HOME environment variable to point to desired JVM
installation path
Add desired JVM <installation-path>/bin to Path environment variable and remove other JVM paths.
(Detailed example for Windows, Example for Ubuntu)
Notice that, this potentially could affect every program that uses Java and does not explicitly reference a specific version of Java in its config.
But If you want the default version to remain intact and only make an exception for some programs you have to do it in their config/settings.
For Example for Eclipse you can modify eclipse.ini file and specify the JVM it uses by adding this line (more info):
-vm
/opt/oracle-jdk-1.8.0/bin/java
or for Windows:
-vm
C:\Java\JDK\1.8\bin\javaw.exe
there is a similar config for glassfish too. You can choose which JVM should be the default version and which the one exceptional programs gonna use, In your case I recommend that keep version 7 as default and change eclipse config to use version 8.
I have a 64bit operating system with phpStorm 9.0.2 installed.
I get out of memory errors and it seems like JVM32bit might not help the cause.
How can I upgrade my JVM32bit version to JVM64bit?
Is it just as simple as downloading a 64bit version and installing it or are there any other extra steps to take to do this correctly?
OS Win 7 64bit
You can run PhpStorm even if you have no Java installed on your computer as on Windows it comes bundled with own 32-bit JRE which will be used by default ignoring your system-wide Java (if you have one).
That's why "uninstall 32-bit Java and just install 64-bit one instead" is not enough (as in some cases you simply have no system-wide Java installed on your computer).
Download and install 64-bit JDK (yes, it has to be JDK and not just JRE)
Create IDEA_JDK_64 environment variable and point it to JDK root folder. For example:
Use 64-bit PhpStorm's executable (PhpStorm64.exe) instead of 32-bit (PhpStorm.exe).
The above works just fine for me.
If anything -- please refer to official support article.
I'm working on a bluetooth java application under eclipse in OS X 10.10.1 Yosemite 64bit with the blue cove-2.1.0 jar. When I run the application I get the error message:
Native Library bluecove not available
Through a web search I found that the issue is caused by the 64 bit version of Java, but when I try to run the application with the -d32 argument passed to the VM I get the error:
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
Is there anyway to run this application despite the 64 bit configuration? or is there any other library despite bluecove that can manage a 64 bit environment?
A similar thing happened to me with a different java application (jruby), around which I was able to work by resetting my JAVA_HOME to a JVM that supports 32-bit mode. Essentially your 64-bit JVM is trying to tell you that it won't run in 32-bit mode, even when you specify the -d32 option.
To work around this, try running: /usr/libexec/java_home -d32
On my 64-bit Yosemite machine, that command returned /Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home, which is the path to a JVM on my machine that will run in 32-bit mode. If you have one or more 32-bit-capable JVMs on your machine, you'll get a path to one of them, which you can then use to set your JAVA_HOME variable accordingly and you'll be off to the races.
If you don't have a 32-bit-capabile JVM on your machine, you will need to install one via the Oracle web site or homebrew and then set your JAVA_HOME accordingly.
If you want to skip a step or two, just do this -- export JAVA_HOME=`/usr/libexec/java_home -d32` -- which will automatically set your JAVA_HOME to the first detected instance of a JVM capable of running in 32-bit mode.
I am trying to setup Android build environment for my Mac 10.8.3
I dont understand, Apple provide instructions on how to revert mac back to Java 1.6 here :
http://support.apple.com/kb/HT5559?viewlocale=en_US&locale=en_US
They are clear instructions that I followed.
Yet when I still get the following :
unknown-98:fe:94:3f:92:ce:~ newuser$ java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Please please help me solve this problem.
The Mac comes with, and occasionally updates, JDKs 1.4 through 1.6. You can see the versions you have installed in this directory:
/System/Library/Frameworks/JavaVM.framework/Versions
This is how you change the JDK
1. Command Line Java
My Java is coming from /usr/bin/java, which points off to one of the versions in the 'Versions' dir described above. To change the version of the JDK you're getting here, use the Java Preferences application under Applications -> Utilities -> Java:
You can drag the JDK you'd like to the top and it should be reflected immediately from the command line:
hostname% java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_16-133, mixed mode)
hostname% java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
2. Scripts and Applications That Use Java
Generally, other built-in applications or one that you install will use the JAVA_HOME environment variable to pick a JDK. By default, you won't have this set, and Mac-specific versions of startup scripts will usually create one by using the CurrentJDK link in the Java 'Versions' directory. The steps to add environment variables are documented in this article, but I can save you a little time. Create a directory .MacOSX in your home directory and add a file called environment.plist. Here are the entire contents of my ~/.MacOSX/environment.plist file:
<!-- When changing this, also run Java Preferences and change there. -->
<key>JAVA_HOME</key>
<string>/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home</string>
With this value set, all processes started as you will have JAVA_HOME available to them. Since this file is read when you log in, you'll have to log out/in once after you create or edit this file.
Special case: NetBeans
The IDE I use is NetBeans, but the following idea probably applies to other large applications as well. When NetBeans is installed, it will pick a JDK to use and hard code it in a properties file. If you want it to rely on the JAVA_HOME that you're now setting in environment.plist, you just need to edit one file. Edit this file:
/Applications/NetBeans/NetBeans\ 6.5.app/Contents/Resources/NetBeans/etc/netbeans.conf
..and you can set the JDK by changing this line:
netbeans_jdkhome=$JAVA_HOME
Note that, as the netbeans.conf file points out, you can always force a different JDK to be used by specifying it on the command line when starting the IDE. For your copying and pasting pleasure, here is the command to use to start it from terminal (I'm giving the 'help' option in this case). If you're using a different version, autocomplete ought to help with the version part of the path:
/Applications/NetBeans/NetBeans\ 6.5.app/Contents/MacOS/netbeans
--help
Recap
To recap, you can switch JDKs for your whole system by using the Java Preferences application along with changing the value in your environment.plist file. To switch on the fly, use the Preferences app and set a new value for JAVA_HOME in whatever terminal you're using, though some apps like NetBeans will still pick up the system value and you should specify the desired JDK on the command line.
Resources where I found this solution: https://blogs.oracle.com/bobby/entry/switching_jdks_on_mac
I have installed a 64 bit Java on a 64 bit Centos machine. My query is that if I dont specify the -d64 option will the JVM run in 32 bit mode even if there is no 32 bit JVM installed ?
Also I was a bit curious if we can use the -d64 option with "javac". If yes, then what does it imply or where could it be used? I came across this when reading this article.
Thanks
The selection of the data model (bits) for the JRE is to constrain the operation of the application to only run in one mode. The java byte code is designed to work in both data models, so for the 100% pure java applications, will work according the behavior and benefits of each architecture.
But, if your application use native libs that work only in one mode, then the application will fail under the not supported one. For that, you must explicitly indicate in which mode it should run.
When you set -d32 or -d64 the JRE will not start your application if it can't run in the selected mode.
From the Oracle document you linked to:
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.
(emphasis mine)
So, according to the document you linked to, the default is to run in a 32-bit JRE, and it is possible to run javac in a 64-bit JRE by passing -J-d64 rather than simply -d64.
However, note that this document also says that it applies to Java 1.4, and says nothing about more recent versions of Java.