package client; public class Client { private String host; private int port; private String directory; public Client() { host = "localhost"; port = 40000; String d; /* Follow XDG Base Directory Specification * https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html */ if (System.getProperty("os.name").equals("Linux")) { d = System.getenv().get("XDG_DATA_HOME"); if (d == null || f.equals("")) { d = System.getenv().get("HOME"); if (d != null && (!f.equals(""))) { d += "/.local/share"; } else { d += "." } } } else { d = "."; } d += "P2P_JAVA_PROJECT_CLIENT/"; // create directory if not already exists new File(d).mkdirs(); } } public static void main(String [] args) { Client c = new Client("client"); ClientManagementUDP cm = new ClientManagementUDP(c.directory, c.host, c.port); Thread t = new Thread(cm); t.setName("client P2P-JAVA-PROJECT"); t.start(); } }