operation system

Discussion in 'Java' started by Anabolik, Aug 10, 2009.

  1. Anabolik

    Anabolik Guest

    How to know if the operation system is 32-bit or 64-bit using java?
     
    Anabolik, Aug 10, 2009
    #1
    1. Advertising

  2. Anabolik

    Eric Sosman Guest

    Anabolik wrote:
    > How to know if the operation system is 32-bit or 64-bit using java?


    What do you mean by "32-bit or 64-bit?"

    Better yet, take a step back and look at the wider issue:
    What problem are you trying to solve, what decision are you
    trying to make?

    Imagine a method

    public static int getOSBitness() {
    // ... TBD ...
    return bits;
    }

    .... in some class, and we imagine that you can call it and
    get a result of 32 or 64 (or maybe something else). What
    will your code do differently depending on the result? There
    may be a more direct way to make the decision than to try to
    infer something from "32-bitness" or "64-bitness."

    --
    Eric Sosman
    lid
     
    Eric Sosman, Aug 10, 2009
    #2
    1. Advertising

  3. Anabolik

    Roedy Green Guest

    On Mon, 10 Aug 2009 04:57:14 -0700 (PDT), Anabolik <>
    wrote, quoted or indirectly quoted someone who said :

    >How to know if the operation system is 32-bit or 64-bit using java?


    see http://mindprod.com/jgloss/wassup.html
    http://mindprod.com/jgloss/properties.html

    sun.arch.data.model = 32

    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    "We must be very careful when we give advice to younger people: sometimes
    they follow it!"
    ~ Edsger Wybe Dijkstra, born: 1930-05-11 died: 2002-08-06 at age: 72
     
    Roedy Green, Aug 10, 2009
    #3
  4. Anabolik

    Roedy Green Guest

    On Mon, 10 Aug 2009 08:07:52 -0700, Roedy Green
    <> wrote, quoted or indirectly quoted
    someone who said :

    >>How to know if the operation system is 32-bit or 64-bit using java?

    >
    >see http://mindprod.com/jgloss/wassup.html
    >http://mindprod.com/jgloss/properties.html
    >
    >sun.arch.data.model = 32


    This is whether the Java is 64 bit, which is probably what you really
    wanted to know.

    Dump out system properties on both a 32 bit and 64 bit OS, and notice
    the differences.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    "We must be very careful when we give advice to younger people: sometimes
    they follow it!"
    ~ Edsger Wybe Dijkstra, born: 1930-05-11 died: 2002-08-06 at age: 72
     
    Roedy Green, Aug 10, 2009
    #4
  5. Anabolik

    Arne Vajhøj Guest

    Roedy Green wrote:
    > On Mon, 10 Aug 2009 04:57:14 -0700 (PDT), Anabolik <>
    > wrote, quoted or indirectly quoted someone who said :
    >> How to know if the operation system is 32-bit or 64-bit using java?

    >
    > see http://mindprod.com/jgloss/wassup.html
    > http://mindprod.com/jgloss/properties.html
    >
    > sun.arch.data.model = 32


    Question is: will this property exist on all JVM's ?

    The name seems to indicate it is SUN specific, but it is present
    in IBM and BEA.

    Arne
     
    Arne Vajhøj, Aug 23, 2009
    #5
  6. Anabolik

    Arne Vajhøj Guest

    Eric Sosman wrote:
    > Anabolik wrote:
    >> How to know if the operation system is 32-bit or 64-bit using java?

    >
    > What do you mean by "32-bit or 64-bit?"
    >
    > Better yet, take a step back and look at the wider issue:
    > What problem are you trying to solve, what decision are you
    > trying to make?
    >
    > Imagine a method
    >
    > public static int getOSBitness() {
    > // ... TBD ...
    > return bits;
    > }
    >
    > ... in some class, and we imagine that you can call it and
    > get a result of 32 or 64 (or maybe something else). What
    > will your code do differently depending on the result?


    Good question.

    A good question that the original poster did not answer.

    The real java'ish answer is: nothing.

    A "good" Java program will not do different things on 32 bit and
    64 bit.

    Arne
     
    Arne Vajhøj, Aug 23, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Sandfox
    Replies:
    1
    Views:
    11,706
    Ken Cox [Microsoft MVP]
    May 3, 2004
  2. =?Utf-8?B?U2FjaGluIFN1cmFuYQ==?=

    System.WebException | The operation has timed out

    =?Utf-8?B?U2FjaGluIFN1cmFuYQ==?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    10,155
    William F. Robertson, Jr.
    Feb 8, 2005
  3. david ullua
    Replies:
    13
    Views:
    669
  4. raan
    Replies:
    2
    Views:
    452
  5. Buzz Lightyear
    Replies:
    10
    Views:
    1,124
    Alexander Bartolich
    Aug 12, 2009
Loading...

Share This Page