2
I’m trying to create a folder with a certain name but I don’t know why it always appears bin+name.
Example: If secondArg = dot then the folder name becomes bindot.
Is it because I’m running in the terminal? Since when I run in the terminal I have to go to the project folder and then to the bin in order to run the class. How can I solve?
private void makeDir(String secondArg) {
File theDir = new File(System.getProperty("user.dir") + secondArg);
// if the directory does not exist, create it
if (!theDir.exists()) {
System.out.println("creating directory: " + theDir.getName());
boolean result = false;
try{
theDir.mkdir();
result = true;
}
catch(SecurityException se){
//handle it
}
if(result) {
System.out.println("Repository " + theDir.getName() + " was been created");
}
}
}
Where your folder should be created?
– Felipe Marinho
In the project folder where the bin and src @Felipemarinho folders are located
– Rafael