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());

Comments

Popular posts from this blog

Exporting Skype Chat/Skype Contacts to csv file using the shell script and sqlite3 (usually already installed on mac)

trim() not supported by IE7 and IE8

Finally, clear explanation of TinyOS 2.x serial packet structure