1
I am on a project and I find myself with the following problem.
a part of the code has the following:
Path caminho2 = Paths.get("C:\\Users\\Evandro\\Documents\\Java\\Player beta 0.9\\src\\Capas\\Gifs".replace("\\", "/"));
List<Path> listaCapas2;
System.out.println(listaImagem2.size());
try {
listaCapas2 = Files.list(caminho2).collect(Collectors.toList());
listaCapas2.forEach((capas2) -> {
listaImagem2.add(new Image(capas2.toFile().toURI().toString()));
});
addItem2(listaImagem2);
} catch (IOException ex) {
ex.printStackTrace();
}
I need this "path" to be for all computers, not just for my.
"Path path path 2 = Paths.get("C: Users Evandro Documents Java Player beta 0.9 src Gifs Covers". replace("\", "/"));"
System.getProperty("user.dir");
returns the user working directory, independent of the machine.– renanvm
however when using this, ; String camioo = pastaGeral + " Documents Java Player beta 0.9 src Gifs Covers"; my project would have to stay in the documents on the other computer. I want the path to be automatic, regardless of the folder where the project is located.
– Evandro Casanova
Then do a routine to create a new directory inside the returned by
System.getProperty("user.dir");
. Because every operating system has a user folder.– renanvm
https://answall.com/questions/42701/como-directcreate%C3%B3rio-com-um-caminho-que-funciona-para-qualquer-so
– renanvm
This folder is inside the java project or is an external resource?
– Gustavo Fragoso