This is the code that i have moved. It was suggested yeterday by an admin guy to move this code into my gui coded area and just put a method that refers to it.
What i am trying to do is using my FileCHooser let the user pick a file then read it in using this method below. But I get a lot of errors and i dont know what is wrong???
Expand|Select|Wrap|Line Numbers
- public class Main {
- public Main()
- {}
- public static void main(String[] args)
- {
- Process p = new Process();
- String filename;
- filename = "";
- if(args.length==0)
- {
- System.out.println("Please enter the filename of the bus network.");
- try
- {
- filename = p.input();
- }
- catch (IOException x)
- {
- System.out.println("Unrecoverable IO Exception.");
- Runtime.getRuntime().exit(0);
- }
- }
- else
- {
- filename = args[0];
- }
- try
- {
- p.readFile(filename);
- }
- catch (IOException x)
- {
- System.out.println("Unrecoverable IO Exception.");
- Runtime.getRuntime().exit(0);
- }
- while(true)
- {
- try
- {
- System.out.println("Please select what you would like to do.");
- System.out.println("Search, Edit, Delete or Exit");
- p.menu(p.input());
- }
- catch (IOException x)
- {
- System.out.println("IO Exception.");
- }
- }
- }
- }
Erorrs are:
Inner classes cannot have static declarations
Java.lang.Process is abstract: cannot initialise
Cannot find method input();
Cannot find method readFile();