I have just found out that Apache Tomcat cannot run as a Windows service if I'm using a 64-bit JDK. Therefore I have additionally installed Java 32-bit on my Windows.
The question is when I checked the java version using java -version, it still shows that 64-bit is still running. How do you switch from 64-bit to 32-bit? It would also be nice to have the ability to switch back to 64-bit later as well.
The question is when I checked the java version using java -version, it still shows that 64-bit is still running.
That's not strictly true. There is no copy of Java still / already running. (Or if there is, you aren't talking to it when you run java -version
.)
What this actually shows is that your command shell runs a 64-bit Java when you gave it the command name java
. And the reason for that is that shell's %PATH% variable is telling the shell to look in the directory containing the 64-bit version, rather than the 32-bit version; i.e. you haven't changed it!
What you need to do is to change the shell's %PATH% and %JAVA_HOME% environment variables to point to the correct place. The %JAVA_HOME% should point to the installation directory, and the %PATH% variable should include %JAVA_HOME%\bin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With