source

Java 32-bit vs 64-bit compatibility

factcode 2022. 9. 25. 00:14
반응형

Java 32-bit vs 64-bit compatibility

Will Java code built and compiled against a 32-bit JDK into 32-bit byte code work in a 64-bit JVM? Or does a 64-bit JVM require 64-bit byte code?

To give a little more detail, I have code that was working in a Solaris environment running a 32-bit JVM, but now I'm getting issues after upgrading the JDK and Weblogic Server to 64-bit.

Yes, Java bytecode (and source code) is platform independent, assuming you use platform independent libraries. 32 vs. 64 bit shouldn't matter.

I accidentally ran our (largeish) application on a 64bit VM rather than a 32bit VM and didn't notice until some external libraries (called by JNI) started failing.

Data serialized on a 32bit platform was read in on the 64bit platform with no issues at all.

What sort of issues are you getting? Do some things work and not others? Have you tried attaching JConsole etc and have a peak around?

If you have a very big VM you may find that GC issues in 64 bit can affect you.

Yes to the first question and no to the second question; it's a virtual machine. Your problems are probably related to unspecified changes in library implementation between versions. Although it could be, say, a race condition.

VM이 거쳐야 하는 몇 가지 홉이 있습니다.특히 참조는 클래스 파일에서 다음과 같은 공간을 차지하는 것처럼 처리됩니다.int스택상에 있습니다. double그리고.long2개의 참조 슬롯을 차지합니다.예를 들어 필드의 경우 VM이 일반적으로 수행되는 재배치가 있습니다.이것은 모두 (상대적으로) 투명하게 행해진다

Also some 64-bit JVMs use "compressed oops". Because data is aligned to around every 8 or 16 bytes, three or four bits of the address are useless (although a "mark" bit may be stolen for some algorithms). This allows 32-bit address data (therefore using half as much bandwidth, and therefore faster) to use heap sizes of 35- or 36-bits on a 64-bit platform.

All byte code is 8-bit based. (That's why its called BYTE code) All the instructions are a multiple of 8-bits in size. We develop on 32-bit machines and run our servers with 64-bit JVM.

당신이 직면하고 있는 문제에 대해 좀 더 자세히 말씀해 주시겠습니까?그럼 저희가 도와드릴 수 있을 것 같습니다.그렇지 않으면 문제가 무엇인지 추측할 뿐입니다.

네이티브 코드(특정 arcitechiture용으로 컴파일된 머신코드)가 없는 한 코드는 32비트 및 64비트 JVM에서 동일하게 동작합니다.

단, 주소가 크기 때문에(32비트는 4바이트, 64비트는 8바이트) 64비트 JVM은 같은 작업에 32비트 JVM보다 더 많은 메모리가 필요합니다.

네이티브 라이브러리와의 인터페이스에서는 32비트와 64비트의 차이가 더욱 중요합니다.64비트 Java는 (JNI 경유로) 32비트 비 Java dll과 인터페이스 할 수 없습니다.

exe를 생성하는 동안 구성에 다음과 같은 매개 변수를 추가합니다.

http://www.technimi.com/index.php?do = / group / param / building - an - exe - using - 32 - bit - jvm /

도움이 됐으면 좋겠어요.

고마워...

/discloses(/disclosed.

Java JNI는 JVM과 동일한 "비트니스" OS 라이브러리를 필요로 합니다.예를 들어 IESHIMS.DLL(%ProgramFiles%에 존재)에 의존하는 것을 구축하려고 하면Internet Explorer)는 JVM이 32비트인 경우 32비트 버전을 사용하고 JVM이 64비트인 경우 64비트 버전을 사용해야 합니다.다른 플랫폼도 마찬가지입니다.

그것 말고도, 당신은 준비가 다 되어 있어야 해요.생성된 Java 바이트 코드 s/b는 동일합니다.

64비트 Java 컴파일러는 더 많은 메모리를 처리할 수 있으므로 더 큰 프로젝트에는 사용해야 합니다.

어디가 잘못됐니!이 주제에 대해 나는 오라클에게 질문을 썼다.정답은.

"32비트 머신에서 코드를 컴파일할 경우 코드는 32비트 프로세서에서만 실행됩니다.64비트 JVM에서 코드를 실행하려면 64비트 JDK를 사용하여 64비트 머신에서 클래스 파일을 컴파일해야 합니다.

언급URL : https://stackoverflow.com/questions/783662/java-32-bit-vs-64-bit-compatibility

반응형