Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  EasyOGG doesn't work in Jar?  (Read 5443 times)
0 Members and 1 Guest are viewing this topic.
Offline CyanPrime
« Posted 2009-04-11 16:09:41 »

Anyone know how to make easyOGG work inside a jar file? It works outside just fine, but once inside it doesn't play any music at all.
Offline Renoria

Junior Devvie




...


« Reply #1 - Posted 2009-04-11 16:46:33 »

what do yo mean "inside"
Offline CyanPrime
« Reply #2 - Posted 2009-04-11 16:50:39 »

once I put the easyOGG jar and the other ones inside mygame.jar it doesn't read the music.ogg file inside the jar, or outside it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Renoria

Junior Devvie




...


« Reply #3 - Posted 2009-04-11 17:38:27 »

use getClass().getClassLoader().getResourceAsStream("song.ogg")
Offline CyanPrime
« Reply #4 - Posted 2009-04-11 17:57:09 »

use getClass().getClassLoader().getResourceAsStream("song.ogg")
try{
         OggClip clip = new OggClip(getClass().getClassLoader().getResourceAsStream("mymusic.ogg"));
        clip.loop();
      }
     
      catch(Exception e)
      {
         e.printStackTrace();
      }

same problem. This could be a big problem if easyOGG doesn't work in jars...
Offline tom
« Reply #5 - Posted 2009-04-11 18:31:30 »

You should not put jars inside jars. Keep the files separate or create one jar containing the files of both jars. Also, instead of "song.ogg" try "/song.ogg". It will make it search threw all the classloaders. (I think)

Offline CyanPrime
« Reply #6 - Posted 2009-04-11 19:13:01 »

You should not put jars inside jars. Keep the files separate or create one jar containing the files of both jars. Also, instead of "song.ogg" try "/song.ogg". It will make it search threw all the classloaders. (I think)
You can't load more than one jar with jnlp. Also using "/mysong.ogg" messes it up worse, as it wouldn't even run outside the jar, nor inside.
Offline tom
« Reply #7 - Posted 2009-04-11 19:31:49 »

You can use as many jars as you want with jnlp. Just add them under the resources tag.

Offline CyanPrime
« Reply #8 - Posted 2009-04-11 19:46:42 »

You can use as many jars as you want with jnlp. Just add them under the resources tag.
That fixed both problems. Thanks!
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (848 views)
2019-09-04 15:33:17

hadezbladez (5799 views)
2018-11-16 13:46:03

hadezbladez (2605 views)
2018-11-16 13:41:33

hadezbladez (6215 views)
2018-11-16 13:35:35

hadezbladez (1501 views)
2018-11-16 13:32:03

EgonOlsen (4736 views)
2018-06-10 19:43:48

EgonOlsen (5794 views)
2018-06-10 19:43:44

EgonOlsen (3278 views)
2018-06-10 19:43:20

DesertCoockie (4176 views)
2018-05-13 18:23:11

nelsongames (5503 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!