简体   繁体   中英

upgrade JDK from 32 bit to 64 bits

I have a program using JDK 1.7 running on Windows Server 2008 (32 bits). If I want to re-deploy the program to the latest Windows Server (64 bits), do I need to rewrite the program or just minor change is ok?

Thanks a lot!

Short answer

No , you should not need to change your code. You don't even need to recompile it. Just run your JAR/class and it should work fine.

You didn't provide much details of your application, so I ask you to read the long answer for more info, since there are considerations which might help you in the future.

Long answer

The Java Compiler generates bytecodes which are later interpreted by the JVM. The JVM translate the bytecode into native commands. The JVM will do the "hard work" while you can focus on one single program. The Java platform is platform independent, therefore you should not need to change your code if you are going from 32 bits to 64 bits Windows.

As always, there are some exceptions , which go beyond the 32/64 bits case. I will list some for example:

  • Breaking lines in Linux and Windows while working with persistence (MS files usually have carriage return)
  • Using JNI to consume native libraries (This might impact 32/64 bit programs)
  • Fonts used on different operational systems
  • Maybe some Java bug, but very improbable

As a general practice, if you are going to cross platform your application, try to find the "boundaries" of your program. When do you have go "outside" your application to seek specific OS resources?

Even if your program runs in an application server, such as JBoss, you should not need to change your code.

I think your program will work fine without any changes, just keep in mind that exceptions may apply.

I don't think you need to change anything. Do you use any native code through jni?

First, are you using JDK or JRE on the 32 bit Windows? You just need JRE to run your application.

Second, on Windows 8, you can still install 32 bit JRE so your application should run.

Third, if you installed 64 bit JRE, your application should still run. There might be more bugs in 64 bit JRE. If you encounter a lot of bugs, just use 32 bit JRE instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM