This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Applets and the fly likes eclipse export jar question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "eclipse export jar question" Watch "eclipse export jar question" New topic
Author

eclipse export jar question

jeff krystyan
Greenhorn

Joined: Apr 02, 2012
Posts: 9
hey everybody,

I just used the export jar feature in eclipse to create a jar file. The jar file should have contained all of the classes and some .wav and .GIF files. When I run the jar file, the class operations operate as intended but without the images and sounds. Any ideas on this?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29233
    
136

The first question is did you try looking in the jar to see if the .wav files are there. (You can view a jar file in any winzip type program.)

If you are there, there's probably a difference between how the code is opening the sound file that only operates on the file system. Please post this is line of code so we can comment.


[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
jeff krystyan
Greenhorn

Joined: Apr 02, 2012
Posts: 9
@ Jeanne,

thanks for replying.

So, for your first question, yes, the all of the files are in the jar file.

below is the code for the wav files.



The string is passed into this portion of a panel where ImageChanger uses the Timer class...




Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5772
    
    7

It would help if we knew what the value of "current" is when MusicPick is called. I suspect, though, that you should be using Class.getClassLoader().getResource() to access a wav file instead of that way you are doing it.


JBoss In Action
 
jQuery in Action, 2nd edition
 
subject: eclipse export jar question
 
Similar Threads
Jar file creation using eclipse
Netbeans, exporting to jar file
how to make jar file with external jars
Creating .jar files (preferably in Eclipse) and adding existing .jar files to them
Main Class Not Found in JAR file