1

Okay, so I'm not entirely sure what I'm doing here.

I have an assignment that requires that I read files called student.txt and classes.txt as well as a couple others and from those create a grade report.

However in my assignment it is required that "file names “student.txt” and “classes.txt” must be passed to the program through command line arguments." I'm not entirely sure what this means.

Throughout my programming class we've been running NetBeans IDE and I honestly don't ever remember him mentioning command line arguments (although I did miss a day last week).

I've looked up tons of tutorials online but anything I've seen has been about using user entered arguments and not files so I have absolutely no idea what to do.

Corey Wall
  • 11
  • 3
  • 3
    Command line arguments are specified as parameters to the main method. See https://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html . Every IDE (like Netbeans) should have a way to specify these arguments - consult the documentation for your IDE – copeg Apr 27 '15 at 18:16
  • I don't understand what you don't understand about the requirement. The strings for the file names need to be passed in as command line arguments. The tutorial provided by Oracle [here](https://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html) is pretty straight forward and even has an example passing in a file name. What specifically did you not understand? Without telling us, we're likely to give you the same explanations you didn't understand already. – tnw Apr 27 '15 at 18:18
  • 1
    possible duplicate of http://stackoverflow.com/questions/9168759/netbeans-how-to-set-command-line-arguments-in-java – Transcendence Apr 27 '15 at 18:21

1 Answers1

0

I googled "netbeans command line arguments" and found a very helpful article: http://netbeanside61.blogspot.com/2009/02/using-command-line-arguments-in.html

It not only describes how to use NetBeans to pass command line arguments to a Java program, it also demonstrates how to access those arguments from your Java code.

Dan Forbes
  • 2,734
  • 3
  • 30
  • 60