aspose file tools*
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: 732
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: 3646
    
  16

What stops working? How do you know? TellTheDetails please.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
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: 7781
    
  21

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: 19693
    
  20

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
How To Ask Questions How To Answer Questions
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
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: 2408
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: 19693
    
  20

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: 732
Thank you Rob very much

Best regards
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

You're welcome.
 
 
subject: Is java machine dependent?