• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

eclipse import image / jar import image

 
Nikos Stavros
Ranch Hand
Posts: 243
Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Tim Holloway
Saloon Keeper
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34965
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Java In General since this isn't specific to IDEs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic