wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes 32 bit class file on 64 bit runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "32 bit class file on 64 bit runtime" Watch "32 bit class file on 64 bit runtime" New topic
Author

32 bit class file on 64 bit runtime

Jyotika Kapoor
Greenhorn

Joined: Apr 25, 2009
Posts: 19

Hi All,

I have a small doubt , how good is it a practice to run a java class file compiled on 32 bit OS on a OS which has jvm for 64 bit OS. I tried googling but could not find anything really worth while , rather what ever i found has confused me more , would be really thankful if you people can help.


Thanks,
Jyotika
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39834
    
  28
Welcome to JavaRanch

Never tried it, but the .class files are in bytecode which is independent of the bits used by the processor, so I would think it will run happily without modification.
Jyotika Kapoor
Greenhorn

Joined: Apr 25, 2009
Posts: 19

Thanks Campbell,

I sort of agree , but then . I am trying to deploy a webservice using Axis 1.4 and Sun jdk 5 , when i trying deploying it on 64 bit jvm i get the following error stack trace


20:54:53,210 ERROR [[AxisServlet]] Servlet.service() for servlet AxisServlet threw exception
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:177)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:142)
at org.apache.axis.utils.cache.ClassCache.lookup(ClassCache.java:85)
at org.apache.axis.providers.java.JavaProvider.getServiceClass(JavaProvider.java:428)
at org.apache.axis.providers.java.JavaProvider.initServiceDesc(JavaProvider.java:461)
at org.apache.axis.handlers.soap.SOAPService.getInitializedServiceDesc(SOAPService.java:286)
at org.apache.axis.deployment.wsdd.WSDDService.makeNewInstance(WSDDService.java:500)
at org.apache.axis.deployment.wsdd.WSDDDeployment.getDeployedServices(WSDDDeployment.java:503)
at org.apache.axis.configuration.FileProvider.getDeployedServices(FileProvider.java:296)
at org.apache.axis.transport.http.AxisServlet.reportAvailableServices(AxisServlet.java:482)
at org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)

but if i change the java home to point to jdk 1.5 for 32 bit it goes fine . I really dont understand why



Thanks

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39834
    
  28
You're welcome

It is worthwhile checking the class which couldn't be found: see whether it was introduced in Java 5.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18990
    
  40


To answer the original question, when Java bytecodes are loaded into the JVM, they are either interpreted (initially in server mode) and/or just-in-time compiled (JIT). It is this JIT that creates either 32 bit codes or 64 bits codes depending on the type of machine.

Basically, Java runs "natively" regardless of the processor, or the number of bits.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Jyotika Kapoor
Greenhorn

Joined: Apr 25, 2009
Posts: 19
Hello Campbell,

I might sound stupid but i really dont understand what is that class it is trying to instantiate and is not finding it ,
in the above logs.


Thanks,
Jyotika
Moojid Hamid
Ranch Hand

Joined: Mar 07, 2009
Posts: 120
Is the 64 bit version a JRE or a JDK? if it is a JRE try using a JDK.
Jyotika Kapoor
Greenhorn

Joined: Apr 25, 2009
Posts: 19

Hello Hamid,

The code was compiled on 32 bit jdk1.5 (as always windows machine) , i am deploying it on a Linux box which has 64 bit jdk and the
jre.

Thanks,
Jyotika
Moojid Hamid
Ranch Hand

Joined: Mar 07, 2009
Posts: 120
Which one is your CLASS_PATH point to, JDK or JRE?
Jyotika Kapoor
Greenhorn

Joined: Apr 25, 2009
Posts: 19

Hi ,

Its the jdk it is pointing to ...

Jyotika
Moojid Hamid
Ranch Hand

Joined: Mar 07, 2009
Posts: 120
how about JAVA_HOME?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14347
    
  22

The problem looks like a classpath error, the program is trying to load a class that's not in the classpath. Check if all the required JAR files and class directories are in the classpath and if your software is configured correctly.

It does not have anything to do with 32-bit or 64-bit.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 32 bit class file on 64 bit runtime