I'm writing a program that is meant to do a number of things. In order to make this as easy as possible I've written a rudimentary command-line parser.
And this is where my problem starts. Tha parser takes a command with it's parameters, separates them and after this is done my intention was to forward this command to specific private methods within the parser. The code looks like this.
------------------------------------------------------------------------
public class Parser_Cards
{
enum Command {shuffle, reset, deal, play, exit, help}
private String[] comName = new String[6];
private char[] argument = new char[2];
File("Commands.cdd"));
private boolean test = false;
private boolean fail = false;
private int i;
private Command coms;
private String realCom, args;
//Constructor
public Parser_Cards()
{
}
//The "main" method of the class, takes a command and verifies
//if it is corrent or not.
public boolean commander(String com) throws IOException
{
//Reads the available commands from a file.
Scanner comScan = new Scanner(new File("Commands.cdd"));
//I would very much like to add the below initialization
//to all the other initializations before the
//constructor, but all I get when I do is an error
//error message telling me the following (keep
//reading after the code)
DeckOfCards doc = new DeckOfCards();
------------------------------------------------------------------------
Unhandled exception type IOException Parser_Cards.java line 37
I've tried to add a "throws IOException to the class declaration but that produces even more error messages. What should I do to fix this?
Thank you in advance.