mardi 13 mars 2018

How do I use ClassPath::getAllClasses in Guava?

How do I use ClassPath::getAllClasses in Guava? The following code is the simplest example that I could make. But it just returns an empty collection! I use Guava 23.0 and Eclipse 4.7.2.

import com.google.common.reflect.*;
import java.io.*;

class Test {
    public static void main(String[] args) {
        try {
            System.out.println(ClassPath.from(Test.class.getClassLoader()).getAllClasses());
        } catch (IOException exception) {
            throw new RuntimeException(exception);
        }
    }
}





Aucun commentaire:

Enregistrer un commentaire