Embedding resources (images, sound bits, etc) into a Java project then use those resources
Just put those resources in the source/package structure and use ClassLoader#getResource() or getResourceAsStream() to obtain them as URL or InputStream from the classpath by the full qualified package path. ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream input = classLoader.getResourceAsStream(“/image.gif”); // … Or if it is in the same package as the current class, you can also obtain … Read more