Reputation: 1270
I´m trying to start the crawler4j example of: crawler4j
When I start the ImageCrawlController I allready fail by the first step args.length < 3, because its 0. How can I make sure, that args is bigger then 3?
public class ImageCrawlController {
public static void main(String[] args) throws Exception {
if (args.length < 3) {
System.out.println("Needed parameters: ");
System.out.println("\t rootFolder (it will contain intermediate crawl data)");
System.out.println("\t numberOfCralwers (number of concurrent threads)");
System.out.println("\t storageFolder (a folder for storing downloaded images)");
return;
}
}
}
Upvotes: 0
Views: 169
Reputation: 1247
'... how can I put a value in the main-function for args? The main-function always starts with args = 0.'
In eclipse: RUN-> RUN CONFIGURATION. In left menu select Java application. Now select tab: ARGUMENTS.
You can call them: System.out.println(args[1]); ///<-2
Upvotes: 1