The is a special argument required by the option - it indicates what replacement separator to use. CSV separates by commas by default (hence the name, Comma Separated Values), but you can use the '-s' option to specify another separator in place of the commas. In the xml2csv-conv.jar, one possible option is '-s '. You can find these by running a JAR file that requires arguments without any arguments or just by Googling the command for documentation. These options are typically specified below the usage description. When you run certain commands from the Terminal, you can include options to modify the command. Usage: xml2csv-conv ) and also a list of options usable with this JAR file. In this case, your terminal is displaying a usage description (e.g. Most likely, you have Java installed, but there is another, different problem with running the JAR file: the JAR file may require certain inputs (or arguments) in order to do its job correctly.
For example, if you do not have Java installed on your computer, an error saying "-bash: java: command not found" may have appeared. For example, this command would run the XML-to-CSV converter and create a CSV file with elements separated by dashes instead of commas: java -jar xml2csv-conv.jar -s "-" my_original_data.xml my_converted_data.csvĬommands with multiple options and arguments can get confusing, so don't be afraid to come to office hours if you need a deeper explanation! On MacĬhances are the Terminal printed out some lines of text that aren't what you expected. The -jar in java -jar myfile.jar is an option for the Java command that tells Java to expect a JAR file (rather than a '.java' file). To use an option, type it's flag (usually a dash followed by a letter or two dashes followed by a word) between the command's name and any arguments you provide.
When you run certain commands from the Command Prompt, you can include options to modify the command. To supply the JAR with these arguments, simply type them after the 'java -jar xml2csv-conv.jar', each separated by space: java -jar xml2csv-conv.jar my_original_data.xml my_converted_data.csv.
Usage: xml2csv-conv ) and also a list of options usable with this JAR file.įor example, the XML-to-CSV converter ( xml2csv-conv.jar) on the CSCI 0931 resources page requires two arguments: a source filename and a destination filename. In this case, your command prompt is displaying a usage description (e.g. For example, if you do not have Java installed on your computer, an error saying "java: command not found" may have appeared. This tells the computer that you want to use Java to run a JAR file called myfile.jar.Ĭhances are the Command Prompt printed out some lines of text that aren't what you expected. To run a JAR file, type 'java -jar myfile.jar'. Now that we're on the Desktop, we can actually run our JAR file.