jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Is java machine dependent? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Is java machine dependent?" Watch "Is java machine dependent?" New topic
Author

Is java machine dependent?

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 833
Hello,

I hear that Java is platform and machine independent but when am uploading classes from my 64bit lab top to 32bit dedicated server then it stops working. Is there any solution?

Best regards
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3995
    
  18

What stops working? How do you know? TellTheDetails please.


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 833
Stephan van Hulst wrote:What stops working? How do you know? TellTheDetails please.


all classes compiled on 64bit are not working on 32bit machine
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8661
    
  23

Farakh khan wrote:all classes compiled on 64bit are not working on 32bit machine

That is not 'telling the details', it is merely repetition.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20080
    
  30

Which Java versions are installed on the two machines? I think the problem is not in the operating system or machine architecture but in the code being compiled on one Java version and being run on an older Java version.
Only native libraries should cause problems when moving a program from a 64-bit system to a 32-bit system or vice versa.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 833
You are right jdk 1.7 is installed on my 64bit machine and jdk 1.6 is working on online dedicated server but this is strange that I downgraded my 64bit to 1.6 and tried but failed. So far as the native libs are concerned I can not say anything.

Is there any quick solution to fix this problem because I have to work on 2 different computers that is really annoying me

Thanks for your reply
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2409
The Java class file format is not dependent on the architecture of the machine they're compiled on. The problem must be elsewhere - you still haven't told us what exactly the problem is.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20080
    
  30

You can compile source files with a JDK 7 to be usable with a Java client if you follow two rules:
1) Do not use any class, interface, method or field that was added in Java 7 (like all of NIO2).
2) Use the -source 1.6 -target 1.6 compiler flags to make the generated class files compatible with Java 6.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 833
Thank you Rob very much

Best regards
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20080
    
  30

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is java machine dependent?
 
It's not a secret anymore!