B4J Question How to know how many ram is installed


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


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.
Upvote 0


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 :)
Upvote 0