In Eclipse once I put a library on the class path, I can use its classes and then right click on the Class name and Eclipse gives suggestions of various classes with matching names that can be imported.
I wish to do a simila开发者_高级运维r thing in NetBeans, so I mouseover or select the classname and click alt+enter as is suggested. But the only options are for creating the class within the application. The library is opencsv - which I have used without trouble in Eclipse (but I want to try NetBeans).
This is my code (I want to import the classes for CSVReader and FileReader) ... but it just gives me the option to create my own):
CSVReader reader = new CSVReader(new FileReader("yourfile.csv"));
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
// nextLine[] is an array of values from the line
System.out.println(nextLine[0] + nextLine[1] + "etc...");
}
I don't want to have to manually write import statements ... I this what NetBeans expects?
You have to use the menu option "Source -> Fix imports" it will generate all missing imports for your
You can import all missing classes by short cut key Alt+shift+i
精彩评论