I am running OSX 10.11 with IntelliJ 14.1.15.
I have a programme which takes a txt file as an argument. I can run it from the terminal through java SearchCmd test.txt and then it allows me to enter a search term and searches that list.
How do I do this from within IntelliJ, so that I can click the run button and it reads the file and I am able to enter a search term in the IntelliJ console.
The main class 'SearchCmd' contains the main method, as such:
public class SearchCmd {
public static void main (String[] args) throws IOException {
String name;
// Check that a filename has been given as argument
if (args.length != 1) {
System.out.println ("Usage: java SearchCmd <datafile>");
System.exit (1);
}
// Read the file and create the linked list
HTMLlist l = Searcher.readHtmlList (args[0]);
}
However, when I try and run this it says: "Usage: java SearchCmd ".
In order to pass the test.txt file to IntelliJ, I entered the file path in the 'Run/Debug Configurations'.
Sadly I can't attach the picture. :-(
Any help on fixing this and helping me run it from IntelliJ will be greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…