How to get .jar resources path?

I’m using a custom method to get pictures from the resources/ folder. The hardcoded path works well when programming during production (src/main/resources/). However when delivering, I would need to …

Proper way to close an AutoCloseable

What is the most reliable pattern to follow when closing an OutputStream, ServerSocket, or other object that implements the AutoCloseable interface? Should I use try-catch-finally? Or a shutdown hook….

Are Locks AutoCloseable?

Are Locks auto-closeable? That is, instead of: Lock someLock = new ReentrantLock(); someLock.lock(); try { // … } finally { someLock.unlock(); } …can I say: try (Lock someLock = new …