1 Reply Latest reply: Apr 25, 2010 12:59 AM by 800577 RSS

    Exploring the management api on mac os x

    800577
      package Core;
      
      import java.lang.management.*;
      
      public class ObjectManager
      {
          public static RuntimeMXBean obj = ManagementFactory.getRuntimeMXBean();
      }
      package UI;
      
      public class Main {
          public static void main(String args[])
          {
              String bcp = Core.ObjectManager.obj.getBootClassPath();
              String cp = Core.ObjectManager.obj.getClassPath();
              String lp = Core.ObjectManager.obj.getLibraryPath();
              System.out.println(bcp);
              System.out.println(cp);
              System.out.println(lp);
          }
      }
      Output...
      /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jsfd.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/ui.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/laf.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/sunrsasign.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jsse.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/charsets.jar
      
      /Users/Neerav/NetBeansProjects/Classpath setter/build/classes:/Users/Neerav/NetBeansProjects/Classpath setter/src
      
      .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
      which is the system classpath of the three? what is the difference between the three... bootclasspath, classpath and library path. thank you.

      Neerav
        • 1. Re: Exploring the management api on mac os x
          800577
          Alright google helped me understand that classpath is local to the application that sets it and bootclasspath is global to all applications. can someone tell me what library path does? a library is a collection of classes and we set the classpath to point to these libraries. then in which scenario do we use a library path?