This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I would like to know whether I can set ImageIcon to read from a relative path, rather, than from the same path where the source code resides. For example my images are located within an images sub-directory relative to the source code. If there is some other way I don't mind knowing either
The following code does not compile it is just to illustrate what I would like to do:
Depending on a path relative to the JVM's current directory isn't really the way to go.
Indeed, classpath resources a better alternative, and there are several ways to go about this.
For instance, using the relevant methods on Class and ClassLoader.
These differ slightly in their behavior though, which can be a bit of a pain.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: reading within a sub-folder using ImageIcon ?