B4J Question How to know how many ram is installed

Discussion in 'B4J Questions' started by electro179, Feb 17, 2018.

  1. electro179

    electro179 Active Member Licensed User


    For my program with B4J, I need to know how many RAM is installed in the computer.

    How can i do it ?

    thank you
  2. keirS

    keirS Well-Known Member Licensed User

    Try the jAWTRobot library as I think that has a get physical memory size method.
  3. udg

    udg Expert Licensed User

    You could find it yourself applying the proper method for the OS your program is running on.
    Windows: use "wmic" (eg. wmic MEMORYCHIP get BankLabel,DeviceLocator,Capacity,Tag)
    Linux: use "dmidecode" (eg. dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024}')
    MacOS: use "SPHardwareDataType" (eg. /usr/sbin/system_profiler SPHardwareDataType | grep " Memory:")

    All methods above untested. I just searched the Internet.
  4. electro179

    electro179 Active Member Licensed User

    Ok thank you

    I will come back if necessary
  5. ThRuST

    ThRuST Well-Known Member Licensed User

    Please come back and let oss know how you used it. The greatest thing with a mind of your own is that someone else likes to do the thinking for you :)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice