Load resource file: absolute from the classpath : Class Path « Development Class « Java
- Java
- Development Class
- Class Path
Load resource file: absolute from the classpath
import java.io.IOException;
import java.net.URL;
public class Main {
public static void main(String[] args) throws IOException {
// absolute from the classpath
URL url = Main.class.getResource("/mypackage/foo.txt");
}
}
Related examples in the same category