Resolving File paths – ‘File not found’ error in Eclipse

Use getClass().getResource() to read a file in the classpath:

URL url = getClass().getResource("register.xml");

Complete code:

URL url = getClass().getResource("register.xml");
File file = new File(url.toURI());

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)