-1

On my 64 bit PC I have installed both 32 bit and 64 bit JRE(Java Runtime Environment). I have a java application. According to my requirements I need to find out which of the installed java (32 bit or 64 bit), my application is using ? Finding java version alone (example : 1.7, 1.8 etc.) is not enough. I need to find out which bit version of JRE (32 bit or 64 bit) my application is using ?

The same implementation I want to do in C# application. I mean I want to know from C# application that which bit version(32 or 64) any java application on same PC will use ?

3
  • Bit detection stackoverflow.com/q/1856565/1737819 Commented Aug 21, 2015 at 4:30
  • 1
    There is almost always a way to avoid needing to know this. Why do you need this information as you may be able to run without it? Commented Aug 21, 2015 at 6:25
  • @Peter It is requirement of our project Commented Aug 21, 2015 at 7:33

1 Answer 1

2

Use SystemUtils class from org.apache.commons.lang :

String bit = System.getProperty("sun.arch.data.model"); //64
// commons-lang
String javaVersion = SystemUtils.JAVA_VERSION; //1.7.0_71
String jreVersion = SystemUtils.JAVA_RUNTIME_VERSION; //1.7.0_71-b14
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Ravi, I want to extend my question. I want to know that the same solution can be implemented from C# application or not ? I mean I want to know from C# application that which bit version of Java a java application will use on same PC.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.