wood burning stoves 2.0*
The moose likes Java in General and the fly likes eclipse import image / jar import image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "eclipse import image / jar import image" Watch "eclipse import image / jar import image" New topic

eclipse import image / jar import image

Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

I have a program that has image icons. When I run my program from eclipse I must use

however When my program is run from a jar I must change the code like this

This is inconveinent. is there an alternative

[ July 24, 2006: Message edited by: Nikos Katsikanis ]
[ July 24, 2006: Message edited by: Nikos Katsikanis ]

Jesus lives
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958

That's not an Eclipse issue or even an IDE issue. That's a general Java question.

BTW, Java accepts forward-slash file separators as acceptable substitutes for OS-dependent file separators in most cases. So you don't need to go to that much work. A statement like:

File myPic = new File ("C:/rootdir/mydir/imagefile.jpg")

Works just as well as

File myPic = new File ("C:\\rootdir\\mydir\\imagefile.jpg")

AND, since the forward slash isn't an escape character, you're less likely to mistype it!

It also understands mixing the two.

Customer surveys are for companies who didn't pay proper attention to begin with.
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30123

Moving to Java In General since this isn't specific to IDEs.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: eclipse import image / jar import image
Similar Threads
path trouble
agument into the main method in eclipse
boring task for anyone that his lots of spare time in there hands
What is this ��
scrollpane not scrolling