Do not do any of these things in production code!

The simplest way is to call Lookup.toString(). If you want the output in a more readable form, do the following and print/format the resulting collection as you wish:

 Lookup.Template tpl = new Lookup.Template (Object.class);
Lookup.Result result = theLookup.lookup (tpl);
Collection c = result.allInstances();
for (Iterator i=c.iterator(); i.hasNext();) {
   Object o =;
   //do what you want

Source: NetBeans FAQ