ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've a question regarding Eclipse and applications deployment. I've just created a simple mp3/ogg player and I want to create an executable jar file so a few friends can test what I'm doing.
I'm having a bit of trouble deploying that application and it's third party dependencies. The thing is, I want to make this as easier to the end-user as possible. I want them to need to install nothing more than JRE. I've a few extra .jar files in my build path (as mp3plugin and jlayer, swt and jface) that I want to be deployed with the application. Those extra jar files were added to my build path by right-clicking in "My project >> properties >> Java Build Path >> Add Library >> User Library".
Everything works fine. When exporting my application to a .jar file (Right-clicking on my project, then "Export >> Java >> Jar file" (and making sure to create a manifest file), everything works fine, except that those required jar files (swt, jplayer, etc) do not follow with the export process.
I wonder how I could deploy an application heavily dependent into third part libraries to be packed as one executable jar file from Eclipse. There are many applications (like JavaTunes) which has everything well packed into one single jar file. How can I do that? I'be been "googling" a while, without success, except for deployment of J2ME from Eclipse (which is not what I need).
Any help would be most welcome.
Thanks in advance!
Last edited by Mega Man X; 09-09-2006 at 12:38 PM.
why not just use xmms ... even xine could play some music files too ...
.
hmmmm... that quite not answer my question, but to answer yours: I want to create a media player myself for learning purposes. Xine is not really made to play mp3 (but can do that if the codecs are properly installed) and I personally dislike how xmms displays in my monitor.
Just because there are already existent applications made for mp3 playback, does not mean that I have nothing new to add either. If we would think that way, then why did peoples create xmms, rhythmbox, Amarok when we all had mpg123. And so far, my little application plays also .mid files, which is ratter handy in Linux, where most of the applications capable of midi playback seems to run randomly.
Last edited by Mega Man X; 09-09-2006 at 01:18 PM.
xmms is the best player out there and xine's visualing during playback is beautifull if i'm not wrong although i admit i hardly use xine to playback sound files ...
May be the problem is you are using a non java graphic library (swt) instead of swing.
Thank you jlliagre for the reply. Well, I created a very simply Swing GUI with a "play" button, which kicks another class that I call MP3Handler which takes the path to the song to play in a constructor. Program runs fine within Eclipse. I've exported the file as an executable jar and made sure that the simple Swing GUI is the one that kicks in when trying to run the player. I got this:
Code:
java -jar player.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javazoom/jl/decoder/J
avaLayerException
at jmp.gui.EmotionPlayerSwing.initGUI(PlayerSwing.java:29)
at jmp.gui.EmotionPlayerSwing.<init>(PlayerSwing.java:20)
at jmp.gui.EmotionPlayerSwing.main(PlayerSwing.java:59)
So it has to be the jlayer that I'm using to mp3 playback, not SWT (I took it away from my path). When going right-clicking in MyProject, I've made sure that the third part libraries are available under Build Path >> Order and Export.
Eclipse just has to have a way to easily deploy applications like this, I think ^_^;;
It looks like Eclipse won't do that, not in an easy way, according to my research on google. Apparently, JBuilder can do that. I wonder if Netbeans also can... hmmmm...
Depending on how much development work you're doing, have a look at ant and/or maven. It lets you separate the build/deployment tasks from the development tasks.
The developers here use Eclipse and check their code into CVS. I export a tag from CVS and run ant to do the compile/build/sign stuff. That way I can make sure that the jars I test are complete, whereas with jar'ing from the IDE there's the risk that I won't get all of the dependencies (as you've already seen).
Thanks guys for the replies. I really appreciated it.
@jlliagre
I hear ya mate. I was actually trying to "escape" from Swing. Swing is perhaps the only thing in Java that I'm not a big fan of. I've spent the past 3 days reading a book on SWT.
@gilead
It sounds very cool. I think Netbeans does that, more or less, already automatically, build your application into a "dist" folder with the dependencies.
@robbbert
Awesome plugin. Already in my "Java bookmarks" ^_^;;
@Everybody
With little to no-effort, I could make my application run on Netbeans (Swing, not SWT). I started playing around with the Visual Editor in a JFrame and I came up with a very good looking application in a few minutes. It was a bit buggy at first, but I think the player looks quite nice ^_^;;. With one mouse click, I can deploy my application in Netbeans with all dependencies nicely packed under the /lib folder. This has to be the first time I used Netbeans for a little bigger application and I've to say, I was very productive, especially when it came down to the GUI development part.
Now I need to learn how "themes" work under Swing. I want my player to have a kinda "unique" look. It's time to spice up this Swing (<< this paragraph sounded ratter perverted, didn't it? ).
Once again, thanks for the help. If I manage to make this player useful, good looking and with good features, I might post it here
Last edited by Mega Man X; 09-09-2006 at 08:30 PM.
But if/when you want to deploy your application to end-users...
... and if you want a GUI setup, that doesn't assume the user already has Java installed...
... then you might want to look at the Most Excellent, Open Source "InnoSetup" tool:
PS:
I agree with you: SWT is great ... but I prefer the less-elegant-but-"pure Java" Swing API.
PPS:
For precisely that reason, I'm careful not to inadvertantly use the Netbeans "layout" managers when I create GUI's in the Netbeans UI design editor.
The way to do this is to *EXPLICITLY* set the layout manager for your main panel, *BEFORE* you start adding any UI controls.
Not off-topic at all mate. I've just tested the installer in my Windows machine and it works great. Very simple to use as well. I'm definitely going to use this one when releasing my stuff (if ever releasing something). Thanks a bunch for the tips
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.