Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 2465 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 Member




...


« 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 Member




...


« 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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (22 views)
2014-09-12 09:08:26

Norakomi (55 views)
2014-09-10 13:57:51

TehJavaDev (67 views)
2014-09-10 06:39:09

Tekkerue (33 views)
2014-09-09 02:24:56

mitcheeb (55 views)
2014-09-08 06:06:29

BurntPizza (39 views)
2014-09-07 01:13:42

Longarmx (24 views)
2014-09-07 01:12:14

Longarmx (30 views)
2014-09-07 01:11:22

Longarmx (30 views)
2014-09-07 01:10:19

mitcheeb (37 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59: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!