Results 1 to 10 of 10
  1. #1
    johnmerlino is offline Member
    Join Date
    May 2014
    Posts
    56
    Rep Power
    0

    Default running java program in 32-bit/64-bit versions of linux

    I wrote some java applications on my computer, which is 32-bit Ubuntu 12.04 LTS. Could the application run on both 32-bit and 64-bit versions of linux? Or could it only run on 32-bit versions of linux?

    System.out.println(System.getProperty("sun.arch.da ta.model")); // outputs 32

    I would like to know if I run it on a 64-bit version of linux if it will take advantage of the performance advantages of 64 bits.
    Last edited by johnmerlino; 07-17-2014 at 08:54 AM.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default Re: running java program in 32-bit/64-bit versions of linux

    Your .class files have nothing to do with a 32/64 bit architecture; its the JVM that has to solve that problem. (and even a 32 bit JVM runs fine on a 64 bit architecture).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default Re: running java program in 32-bit/64-bit versions of linux

    The byte code is the same, so you won't have any problems.

    It's up to the JVM installed on the 64 bit machine to make the most of the 64 bits, not your code.

    ETA: Captain Slow strikes again...
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,016
    Rep Power
    6

    Default Re: running java program in 32-bit/64-bit versions of linux

    Quote Originally Posted by JosAH View Post
    Your .class files have nothing to do with a 32/64 bit architecture; its the JVM that has to solve that problem. (and even a 32 bit JVM runs fine on a 64 bit architecture).

    kind regards,

    Jos
    Unless you have libraries which use JNI and need an additional native module; then it -does- become a problem of the application deployment.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default Re: running java program in 32-bit/64-bit versions of linux

    Quote Originally Posted by gimbal2 View Post
    Unless you have libraries which use JNI and need an additional native module; then it -does- become a problem of the application deployment.
    Yep, but native libraries aren't .class files and are a pita when it comes to porting all your code ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,016
    Rep Power
    6

    Default Re: running java program in 32-bit/64-bit versions of linux

    Agreed!
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default Re: running java program in 32-bit/64-bit versions of linux

    Quote Originally Posted by gimbal2 View Post
    Agreed!
    I once fiddled a bit with 'JNA': it claims that it can 'trampoline' to native code through its 'foreign function interface' (i.e. no JNI wrappers are needed) but for me it only slapped me in the face with segmentation violations and bus errors; and then I forgot all about it ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,016
    Rep Power
    6

    Default Re: running java program in 32-bit/64-bit versions of linux

    And that from the guy that casually ported Java to a PDA just to be able to hammer in code on the device itself.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default Re: running java program in 32-bit/64-bit versions of linux

    Quote Originally Posted by gimbal2 View Post
    And that from the guy that casually ported Java to a PDA just to be able to hammer in code on the device itself.
    Casually? Casually you say? We worked twenty nine hours per day to carry all those bits over to that old PDA on the bottom of the lake while chewing on all that gravel between them and our mum used to beat us up continuously. Casually, phah ...

    kind regards,

    Jos (bits are made of wood)
    cenosillicaphobia: the fear for an empty beer glass

  10. #10
    johnmerlino is offline Member
    Join Date
    May 2014
    Posts
    56
    Rep Power
    0

    Default Re: running java program in 32-bit/64-bit versions of linux

    thanks for useful responses

Similar Threads

  1. Replies: 13
    Last Post: 07-01-2013, 10:02 PM
  2. Running executable through Java on linux
    By otacon in forum New To Java
    Replies: 4
    Last Post: 03-27-2012, 06:39 PM
  3. Running Linux
    By selva.bics in forum AWT / Swing
    Replies: 1
    Last Post: 08-31-2009, 07:01 PM
  4. How do you run a java program in linux?
    By rayzinnz in forum New To Java
    Replies: 4
    Last Post: 07-17-2009, 08:18 AM
  5. Running Tomcat in Linux from Eclipse.
    By Felissa in forum Eclipse
    Replies: 1
    Last Post: 06-05-2007, 05:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •