Get the current path of the web project - alternative way
This alternative way to get absolute path for some of the things, is useful when you need to read or write a some project related file and use it later again.
File file=new File(.class.getClassLoader().getResource("WEB-INF/").getFile());
System.out.println("path is:"+file.getAbsolutePath());
File file=new File(
System.out.println("path is:"+file.getAbsolutePath());
Comments