List of usage examples for java.nio.file Path toAbsolutePath
Path toAbsolutePath();
From source file:Test.java
public static void main(String[] args) throws Exception { Path zip = Paths.get("/usr/bin/zip"); System.out.println(zip.toAbsolutePath().toString()); }
From source file:Main.java
public static void main(String[] args) { Path dir = Paths.get("."); System.out.printf("%nThe file tree for %s%n", dir.toAbsolutePath()); try (Stream<Path> fileTree = Files.walk(dir)) { fileTree.forEach(System.out::println); } catch (IOException e) { e.printStackTrace();/*from w w w . j av a 2s .co m*/ } }
From source file:Main.java
public static void main(String[] args) throws Exception { Path path = Paths.get("/home", "docs", "users.txt"); System.out.println("Absolute path: " + path.toAbsolutePath()); }
From source file:Test.java
public static void main(String[] args) { try {// w w w.j a v a 2s. c om Path path = Paths.get("/home\0", "docs", "users.txt"); System.out.println("Absolute path: " + path.toAbsolutePath()); } catch (InvalidPathException ex) { System.out.println("Bad path: [" + ex.getInput() + "] at position " + ex.getIndex()); } }
From source file:Test.java
public static void main(String[] args) { Path path = Paths.get("/home/docs/../music/A.mp3"); System.out.println("Absolute path: " + path.toAbsolutePath()); System.out.println("URI: " + path.toUri()); System.out.println("Normalized Path: " + path.normalize()); System.out.println("Normalized URI: " + path.normalize().toUri()); System.out.println();//from w ww . ja v a2s.c o m path = Paths.get("/home/./music/A.mp3"); System.out.println("Absolute path: " + path.toAbsolutePath()); System.out.println("URI: " + path.toUri()); System.out.println("Normalized Path: " + path.normalize()); System.out.println("Normalized URI: " + path.normalize().toUri()); }
From source file:Main.java
public static void main(String[] args) throws Exception { Path p2 = Paths.get("test2.txt"); java.net.URI p2UriPath = p2.toUri(); System.out.println("Absolute Path: " + p2.toAbsolutePath()); System.out.println("URI Path: " + p2UriPath); }
From source file:br.com.RatosDePC.Brpp.BrppCompilerMain.java
public static void main(String[] args) { // TODO Auto-generated method stub File f = new File(FileUtils.getBrinodirectory()); f.mkdirs();//from w ww .ja v a 2 s . c om File l = new File(FileUtils.getBrinodirectory() + "/bibliotecas"); l.mkdirs(); Path currentRelativePath = Paths.get(""); String s = currentRelativePath.toAbsolutePath().toString(); File destDir = new File(s + System.getProperty("file.separator") + "Arduino" + System.getProperty("file.separator") + "libraries"); try { JSONUtils.config(s); } catch (IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { FileUtils.copyFolder(l, destDir); KeywordManagerUtils.processLibraries(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } BrppIDEFrame frame = new BrppIDEFrame("Brino " + BrppCompiler.version); frame.setSize(500, 600); frame.setVisible(true); frame.setLocation(100, 30); }
From source file:Main.java
public static void main(String[] args) { Path path = Paths.get("C:", "tutorial/Java/JavaFX", "Topic.txt"); //convert relative path to absolute path Path path_to_absolute_path = path.toAbsolutePath(); System.out.println("Path to absolute path: " + path_to_absolute_path.toString()); }
From source file:Main.java
public static void main(String[] args) { List<String> texts = new ArrayList<>(); texts.add("test"); texts.add("test"); Path dest = Paths.get("twinkle.txt"); Charset cs = Charset.forName("US-ASCII"); try {//from w w w .j a v a 2 s . c om Path p = Files.write(dest, texts, cs, StandardOpenOption.WRITE, StandardOpenOption.CREATE); System.out.println("Text was written to " + p.toAbsolutePath()); } catch (IOException e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { Path path = FileSystems.getDefault().getPath("/home/docs/status.txt"); path = Paths.get("/home", "docs", "users.txt"); System.out.println("Absolute path: " + path.toAbsolutePath()); path = Paths.get("home", "docs", "users.txt"); System.out.println("Absolute path: " + path.toAbsolutePath()); }