This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "eclipse import image / jar import image" Watch "eclipse import image / jar import image" New topic
Author

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: 15665
    
  15

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
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

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
agument into the main method in eclipse
What is this ��
boring task for anyone that his lots of spare time in there hands
path trouble
scrollpane not scrolling