{"id":511,"date":"2014-08-27T16:25:31","date_gmt":"2014-08-27T21:25:31","guid":{"rendered":"http:\/\/bitc.bme.emory.edu\/~lzhou\/blogs\/?p=511"},"modified":"2014-08-27T16:25:38","modified_gmt":"2014-08-27T21:25:38","slug":"running-32bit-java-program-in-64bit-linux-jmrui","status":"publish","type":"post","link":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/?p=511","title":{"rendered":"Running 32bit java program in 64bit Linux (jMRUI)"},"content":{"rendered":"<p>First, why?  It is well known that 64 bit java platform can run java code compiled in 32 bit development environment.  However, some java codes call C++ libraries.<br \/>\nFor example, if for some reason you will have to run a very old &#8211; stopped developing program, like jMRUI, which was programmed in the 32 bit era, with all 32 bit libs.  If you load it with 64 bit java, the java part will run properly.  However, the other old 32 bit c++ libs, like libfftw.so, will get wrong ELF class error, like<br \/>\nlibfftw.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch) <\/p>\n<p>In this case, you must have 32 bit java platform to run it properly.<\/p>\n<p>In 64 bit linux (CentOs for example), if you already have 64bit linux installed, like<br \/>\njava-1.7.0-openjdk-1.7.0.55-2.4.7.1.el6_5.x86_64<br \/>\njava-1.6.0-openjdk-1.6.0.0-5.1.13.3.el6_5.x86_64<br \/>\nand you try to download and install a 32bit version:<br \/>\nyum install java-1.6.0-openjdk-1.6.0.0-6.1.13.4.el6_5.i686.rpm<br \/>\nyou will get<br \/>\nExamining java-1.6.0-openjdk-1.6.0.0-6.1.13.4.el6_5.i686.rpm: 1:java-1.6.0-openjdk-1.6.0.0-6.1.13.4.el6_5.i686<br \/>\nMarking java-1.6.0-openjdk-1.6.0.0-6.1.13.4.el6_5.i686.rpm as an update to 1:java-1.6.0-openjdk-1.6.0.0-5.1.13.3.el6_5.x86_64<br \/>\nError: Nothing to do<br \/>\nwhich means that the yum wants to update the 64 bit version by the 32 bitc version.  For sure this won&#8217;t work out.<br \/>\nHowever, java 32 bit version is surely possible to work in 64 bit OS.<br \/>\nYou may look into \/usr\/lib\/jvm and see the parallelly installed javas:<br \/>\n\/usr\/lib\/jvm\/java-1.6.0-openjdk-1.6.0.0.x86_64<br \/>\n\/usr\/lib\/java-1.7.0-openjdk-1.7.0.55.x86_64 <\/p>\n<p>Then how to do it?<br \/>\nIt is too much a work to self-compile java.<br \/>\nHere is a short cut:<br \/>\n1. You install a 32 bit linux virtual machine, or if you still have a 32bit linux computer, it will be easier.  (Do not worry, I am not suggesting you to do your work in a slow 32 bit virtual machine.)<br \/>\n2. Install Java inside the 32 bit box, either virtual or real, does not matter.<br \/>\n3. Copy all content in the \/usr\/lib\/jvm\/java-1.7.0-openjdk-1.7.0.?? to your jump drive using<br \/>\nrsync -av java-1.7.0-openjdk-1.7.0.?? \/your_jump_drive\/<br \/>\n4. Plug your jump drive into your 64bit computer, copy the java to its proper place:<br \/>\nrsync -av \/your_jump_drive\/java-1.7.0-openjdk-1.7.0.?? \/usr\/lib\/jvm\/<br \/>\n5. Now you have your 32bit java in your lib location. You may leave it as is, or cover it by running<br \/>\nyum install java-1.6.0-openjdk-1.6.0.0-6.1.13.4.el6_5.i686.rpm<br \/>\nThis time it will work.<br \/>\n6. Modify your script of starting your java program.  As for jMRUI, revise the file<br \/>\njmrui.sh<br \/>\nreplace the work java with<br \/>\n\/usr\/lib\/jvm\/java-1.7.0-openjdk-1.7.0.??\/bin\/java -d32<br \/>\nwhere the ?? is the subversion of java you installed. For my current case, 55.<br \/>\nTo make the file from<br \/>\njava -Xss2m -mx1200m -Djava.library.path=lib -jar lib\/mrui.jar<br \/>\nto<br \/>\n\/usr\/lib\/jvm\/java-1.7.0-openjdk-1.7.0.55\/bin\/java -d32 -Xss2m -mx1200m -Djava.library.path=lib -jar lib\/mrui.jar<br \/>\nNow, your old 32bit java based software will work properly.<br \/>\nHave fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First, why? It is well known that 64 bit java platform can run java code compiled in 32 bit development environment. However, some java codes call C++ libraries. For example, if for some reason you will have to run a very old &#8211; stopped developing program, like jMRUI, which was programmed in the 32 bit [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,1,3],"tags":[],"class_list":["post-511","post","type-post","status-publish","format-standard","hentry","category-computer-tips","category-uncategorized","category-mri-technical-support","post-blog"],"_links":{"self":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=511"}],"version-history":[{"count":1,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":512,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/511\/revisions\/512"}],"wp:attachment":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}