#classpath

Interesting Links – 29 Sep 2016

The reflections project scans your classpath, indexes the metadata, allows you to query it on runtime and may save and collect that information for many modules within your project. “try { return } finally {}” demonstrates what happens when a finally block modifies a reference that’s being returned in the try block. It’s rather interesting. Need to generate fake data? https://github.com/DiUS/java-faker to the rescue. It’s a port of a popular...

2 minute(s) read

How to access static resources in Java

Your Java app may need access to data that you intend to ship directly with your code and which will not change without a version update. Examples might include a list of countries to show in a country dropdown, or icon images for a web or Swing application. The proper mechanism to access these files is: YourClass.class.getResource("file.txt"); // or YourClass.class.getResourceAsStream("file.txt"); This mechanism is built into java and will...

6 minute(s) read