Macklin guy Macklin guy - 9 months ago 50
Java Question

Java reading from textfile

Is it possible to read

from a text file and somehow put the IP in first arg and port in second arg?
(ip, port)


that is a better way to work with. but this is what you are looking for (i guess)

File file = new File("path/of/your/file");
    Scanner sc = new Scanner(file);
        String line = sc.nextLine();
        String str[] = line.split(":");
        String strIP = str[0]; // this will be the IP Address
        String strPort = str[1]; // this will be the Port Number
}catch(IOException e)
      // work with the errors here