Skip to Content

Get Java Runtime Example

  1. /*
  2.         Get Java Runtime Example
  3.         This get java runtime examples shows how to get the runtime
  4.         in which the java application is running. Runtime allows us
  5.         to interface with the environment in which the current
  6.         application is running.
  7. */
  8.  
  9. public class GetJavaRuntime {
  10.        
  11.         public static void main(String args[])
  12.         {
  13.                 /*
  14.                  * Current runtime can be obtained using getRuntime method
  15.                  * of Runtime class.
  16.                  *
  17.                  * getRuntime method is a static method. Application can not
  18.                  * create instance of this class.
  19.                  */
  20.                  
  21.                  Runtime runtime = Runtime.getRuntime();
  22.                
  23.         }
  24. }
  25.  
  26. /*
  27. Output of this program would be,
  28. Current java runtime obtained!
  29. */