JavaRelease.st
changeset 3400 04b5daf050d9
parent 3399 673ed393d7b3
child 3508 622620308fee
--- a/JavaRelease.st	Mon Mar 16 09:40:45 2015 +0000
+++ b/JavaRelease.st	Tue Mar 17 20:56:13 2015 +0000
@@ -1324,6 +1324,42 @@
 
 !JavaRelease methodsFor:'testing'!
 
+is32bit
+    "Return true, if JRE / JDK represented by this release is
+     32bit, false otherwise.
+
+     Note, that for STX:LIBJAVA whether the release is 32bit or 64bit does not
+     matter as it does not use any of its shared objects. This method is provided
+     here as a courtesy for applications which may use JavaRelease to check for
+     installed JREs / JDKs.
+    "
+
+    | javaExecutable |
+
+    javaExecutable := self jreHome / 'bin' / (OperatingSystem isMSWINDOWSlike ifTrue:[ 'java.exe' ] ifFalse:[ 'java' ]).
+    ^ (OperatingSystem getObjectFileInfoFor: javaExecutable) isFor32BitArchitecture
+
+    "Created: / 17-03-2015 / 20:46:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+is64bit
+    "Return true, if JRE / JDK represented by this release is
+     64bit, false otherwise.
+
+     Note, that for STX:LIBJAVA whether the release is 32bit or 64bit does not
+     matter as it does not use any of its shared objects. This method is provided
+     here as a courtesy for applications which may use JavaRelease to check for
+     installed JREs / JDKs.
+    "
+
+    | javaExecutable |
+
+    javaExecutable := self jreHome / 'bin' / (OperatingSystem isMSWINDOWSlike ifTrue:[ 'java.exe' ] ifFalse:[ 'java' ]).
+    ^ (OperatingSystem getObjectFileInfoFor: javaExecutable) isFor64BitArchitecture
+
+    "Created: / 17-03-2015 / 20:46:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 isJava6
     ^ false