Get all packages

ReturnMethodSummary
static Package[]getPackages()Get all the packages currently known for the ClassLoader.

public class Main {
  public static void main(String[] args) {
    Package[] ps = Package.getPackages();
    
    for(Package p:ps){
      System.out.println(p);
    }

  }
}

The output:


...
...
...
...
package java.applet, Java Platform API Specification, version 1.6
package java.lang.ref, Java Platform API Specification, version 1.6
package javax.swing.event, Java Platform API Specification, version 1.6
...
...
...
...
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.