aspose file tools*
The moose likes Java in General and the fly likes How do you include libraries (JMF specifically)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How do you include libraries (JMF specifically)?" Watch "How do you include libraries (JMF specifically)?" New topic
Author

How do you include libraries (JMF specifically)?

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

I installed JMF (Java Media Framework). It is necessary for a test file that I ran. It worked perfectly. I was just wondering how do I include JMF libraries in my program. I use the command line and Notepad++, so IEDs are a no go. Do I just put in my code:

and then in my JAR file include the jmf.jar file?
I've never used or made a library in an application, so sorry if I'm totally off.
Thanks,
cc11rocks aka John Price


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42910
    
  68
You don't import files (you import packages) and then add the corresponding jar files to your classpath at runtime (the classpath can contain multiple jar files).
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

I'm so frustrated, I'm about to shoot Java.
Where all the JAR files are: "E:\MediaTest"
Where the two class files I need are "E:"
I am running it off of my flash drive.
Here is the error I receive when I try to run it...

How do I make this work?
Here is the DIR for E:

DIR for E:\MediaTest:

What the heck?
Here is MediaTest.java and MediaPanel.java
MediaPanel.java:

MediaTest.java:

cc11rocks aka John Price
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42910
    
  68
java.lang.NoClassDefFoundError: E:\MediaTest

That's the key part: you're specifying a class called "E:\MediaTest" which doesn't exist (because the class is called "MediaTest"). Class names and file names are not the same thing, and are not interchangeable. The "E:\" part needs to go into the classpath. So instead of

java -cp E:\MediaTest\*.jar;E:\MediaTest\*.properties;E:\MediaTest\*.properties.orig E:\MediaTest

you need something like

java -cp E:\MediaTest\*.jar;E:\MediaTest\*.properties;E:\MediaTest\*.properties.orig;E:\ MediaTest
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

It works now, thank you. Now I want to convert the class files into an executable jar file. Would I just do the same thing?
Something like this? :

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42910
    
  68
You wouldn't specify a classpath (it's not needed). But you may want to include the properties files in the jar file (depending on what those are, and how they get used).
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

But how does the JAR just know to look for a library?
Thanks,
cc11rocks aka John Price
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42910
    
  68
Why would "jar" need access to the libraries? It's a tool to bundle files (specifically, class files) together.

Or are you saying that you want to bundle ALL classes -including JMF- into a single jar file? That would be more involved, and not really necessary. Not commonly done, either.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

Could you give me a working example? It keeps saying "No media player found" on another computer (that does not have JMF installed). The example should include a JAR file (with 1-2 classes) and a library (preferabley in the form of a JAR file). I am having SOOO much trouble with this.
John Price aka cc11rocks

EDIT: Just found something that may fix the "problem".

http://download.oracle.com/javase/tutorial/deployment/jar/downman.html

The solution goes in the manifest file, specifying the class path.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

Yep, that was the solution. I just had to add:

to the manifest file.
The weird thing is that mp3 files are not working...
If you know what is wrong, please share.
Thanks,
cc11rocks aka John Price
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do you include libraries (JMF specifically)?