Commit 3c93c62b authored by trh010's avatar trh010
Browse files

Trying to figure out input file path

parent 866d4940
package main; package main;
import java.util.ArrayList;
public class AdjacencyList { public class AdjacencyList {
private ArrayList<ArrayList<String>> adjList;
public AdjacencyList(){
adjList = new ArrayList<ArrayList<String>>();
}
} }
...@@ -5,18 +5,28 @@ import java.io.FileNotFoundException; ...@@ -5,18 +5,28 @@ import java.io.FileNotFoundException;
import java.util.Scanner; import java.util.Scanner;
public class Main { public class Main {
public static void main(String[] args){ AdjacencyList adjList;
//reads args[0] for input file path public Main(){
File file = new File(args[0]); adjList = new AdjacencyList();
}
public void createGraph(String path){
File file = new File(path);
try { try {
Scanner in = new Scanner(file); Scanner in = new Scanner(file);
System.out.println(in.next());
in.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
System.err.println("Error in opening the file: " + args[0] + ". Please check the file path."); System.err.println("Error in opening the file: " + path + ". Please check the file path.");
} }
}
public static void main(String[] args){
Main main = new Main();
main.createGraph(args[0]);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment