About 52 results
Open links in new tab
  1. Preferred way of loading resources in Java - Stack Overflow

    Oct 5, 2010 · Will load the resource with the system class loader (it would have to be absolutely referenced as well, as you won't be able to put anything into the java.lang package (the package of …

  2. java - Meaning of @Resource annotation - Stack Overflow

    I'm unable to understand the meaning of the @Resource annotation. I've looked at online resources, but they seem to explain the same in a way which is difficult to comprehend. Can someone please ex...

  3. java - Get a resource using getResource () - Stack Overflow

    Just be aware that Class#getResource and ClassLoader#getResource are using different strategies to map the name to a location. LucaB's example actually uses the ClassLoader from …

  4. java - How do I load a file from resource folder? - Stack Overflow

    Alternatively, if you need an instance of java.io.File, you can employ the getResource() method to retrieve the resource as a URL, and create a File from the resource's path or URI.

  5. Get a list of resources from classpath directory - Stack Overflow

    I am looking for a way to get a list of all resource names from a given classpath directory, something like a method List<String> getResourceNames (String directoryName).

  6. open resource with relative path in Java - Stack Overflow

    Feb 22, 2009 · Upon reading the Java docs instructions, if your resource is not in the same package as the class you are trying to access the resource from, then you have to give it relative path starting …

  7. java - How to get resources directory path programmatically - Stack ...

    115 I have the following directory layout: src main java resources sql (scripts for database) spring (configuration) webapp Within a ServletContextListener class, I want to access the files under the …

  8. URL to load resources from the classpath in Java

    In Java, you can load all kinds of resources using the same API but with different URL protocols:

  9. java - How to get Path to resource folder in jar file - Stack Overflow

    Nov 8, 2021 · 2 Use class that is in parellel to the resource and use its getResourceAsStream method. For an example for following structure you can use below code.

  10. Read resource text file to String in Java - Stack Overflow

    Is there a way to read a text file in the resource into a String?