Snippets Collections
String fileFullPath = "Your\\java\\ file \\full\\path";
    JavaDocBuilder builder = new JavaDocBuilder();
    builder.addSource(new FileReader( fileFullPath  ));

    JavaSource src = builder.getSources()[0];
    String[] imports = src.getImports();

    for ( String imp : imports )
    {
        System.out.println(imp);
    }
star

Wed Apr 01 2020 10:09:44 GMT+0000 (UTC) https://stackoverflow.com/questions/5701305/how-to-get-all-imports-defined-in-a-class-using-java-reflection

#java #java #reflection #dependencies

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension