• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AUDIO PLAYERS

 
Ryan Greenwood
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
InputStream is = getClass().getResourceAsStream("WHAT SHOULD THIS STRING HOLD - FILE NAME ONLY OR PACKAGE PATH OR WHAT?");
players[i] = Manager.createPlayer(is, "audio/basic");

IF ONLY A FILE NAME - WHERE SHOULD THE FILE BE STORED IN SUNS J2ME WDTK TO BE FOUND?
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello "greenman",

Please change your display name to conform to JavaRanch's naming policy, which you had agreed when you registered.

http://www.javaranch.com/name.jsp

About your question, the media files can be bundled inside the JAR file.
 
Ryan Greenwood
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Michael

My name is Ryan Greenwood which is a reserved log in by someone else. All other names attempted were met with the same message so I opted for a unique mail address.

Thanks for the note on the Jar file. I understand this is the prescribed way to package resources however the question is how do I specify the resources location such as "package/package/xxxxx.jar'. While developing it presumably is not necessary to package everything. I have placed the files in the res directory, in the class directory of my project amongst others, yet they remain unfound as InputStream is assigned null value.
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ryan,

You do not need to change your login name. You just need to change your "display name" (or "screen name", or "nick name") so that it displays properly in your post. Thanks.

In order to access the resource files, you have to build the JAR file first. Some IDE tools might build the JAR automatically for you so you do not see it. In this case, you need to find out what your tool does behind the scene and what resource directory it choose to bundle into the JAR.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic