Results 1 to 2 of 2
- 06-02-2010, 04:38 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
trouble with images .jpg's in linux
Im having trouble getting Image .jpg's to show up in an executable JAR in linux. When I run the project in DrJava images are there. When I run a compiled JAR in windows it works fine, but the compiled JAR in linux has images missing. I have other images for buttons that work fine. The albumart[i] contains a folder with an image in it like
60/609830cb-a007-4c46-8039-5ad1d7a0139f
I printed the complete URL's they all look fine but none of the album images show up not even the default_m.jpg
Here is the printed URL that I get:
images/album/60/609830cb-a007-4c46-8039-5ad1d7a0139f_m.jpg
All the paths are right I placed images/album/60/etc.....etc in the compiled JAR
Anyone know what could be wrong?
Thanks,
John
Java Code:String resourcePath = "images/album/"+albumart[i]+"_m.jpg"; URL flagUrl = getClass().getResource(resourcePath); boolean exists = flagUrl != null; System.out.println(resourcePath); if (!exists){ resourcePath = "images/album/default_m.jpg"; } ImageIcon icon = new ImageIcon("images/album/"+albumart[i]+"_m.jpg");
- 06-02-2010, 03:24 PM #2
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
Okay I got it working. I just had to look at the images that were working right.
Java Code:String resourcePath = "images/album/"+albumart[i]+"_m.jpg"; URL flagUrl = getClass().getResource(resourcePath); boolean exists = flagUrl != null; //System.out.println(resourcePath); if (!exists){ resourcePath = "images/album/default_m.jpg"; } ImageIcon icon = new ImageIcon(getClass().getResource(resourcePath));
Similar Threads
-
SwingGUI Fret http://linux-sound.org/images/blog/full-size/2-guitar-codex-plus.png
By ntagrafix in forum AWT / SwingReplies: 3Last Post: 11-11-2009, 03:19 AM -
runable . jar in linux
By pellebye in forum EclipseReplies: 11Last Post: 08-22-2009, 03:47 PM -
Where to get jdk1.5 for linux
By ran_sushmi in forum Advanced JavaReplies: 0Last Post: 07-20-2009, 02:46 PM -
[SOLVED] Windows Linux conflict - TrayIcon image not display in Linux
By Eranga in forum Advanced JavaReplies: 6Last Post: 04-08-2009, 04:05 AM -
Java On Linux
By Natrix in forum New To JavaReplies: 15Last Post: 04-08-2009, 12:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks