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); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter