LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-09-2006, 11:56 AM   #1
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Eclipse: Deploying Java Applications help


Hi all!

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.
 
Old 09-09-2006, 12:20 PM   #2
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
why not just use xmms ... even xine could play some music files too ...


.
 
Old 09-09-2006, 12:38 PM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
May be the problem is you are using a non java graphic library (swt) instead of swing.
 
Old 09-09-2006, 12:46 PM   #4
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Original Poster
Rep: Reputation: 65
Quote:
Originally Posted by alred
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.
 
Old 09-09-2006, 01:02 PM   #5
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
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 ...


you can use 'timidity -ig' instead ...


.
 
Old 09-09-2006, 01:11 PM   #6
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Original Poster
Rep: Reputation: 65
Quote:
Originally Posted by jlliagre
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 ^_^;;
 
Old 09-09-2006, 01:50 PM   #7
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Original Poster
Rep: Reputation: 65
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...
 
Old 09-09-2006, 02:08 PM   #8
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Original Poster
Rep: Reputation: 65
Netbeans actually does it ^_^. However, I'm unable to run SWT classes from Netbeans... hmmmm... more googling I guess
 
Old 09-09-2006, 04:48 PM   #9
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
As I wrote, swt is not java, you loose portability with it. You need to have swt native libraries installed for swt to work.
 
Old 09-09-2006, 05:23 PM   #10
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
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).
 
Old 09-09-2006, 05:59 PM   #11
robbbert
Member
 
Registered: Oct 2005
Location: Hannover, Germany
Distribution: Let there be Ubuntu... :o)
Posts: 573

Rep: Reputation: 32
The FatJar Eclipse plugin might fit.
 
Old 09-09-2006, 08:29 PM   #12
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Original Poster
Rep: Reputation: 65
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.
 
Old 09-09-2006, 09:57 PM   #13
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, MegaMan X -

Apologies if this is a bit off-topic...

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:

http://www.jrsoftware.org/isinfo.php

IMHO .. PSM

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.
 
Old 09-10-2006, 10:59 AM   #14
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Original Poster
Rep: Reputation: 65
@paulsm4

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
 
Old 09-10-2006, 01:17 PM   #15
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
he still intend to go ahead with that little thing , aaaaarrrraggh ...


.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Test Applications Using Eclipse TPTP LXer Syndicated Linux News 0 08-29-2006 03:54 PM
LXer: Creating Accessible Applications with Eclipse LXer Syndicated Linux News 0 12-28-2005 12:01 AM
Need help with Java and Eclipse VE Veteq Programming 1 11-10-2005 07:01 PM
java and eclipse eng_raar Programming 4 01-08-2005 05:20 PM
Deploying Java program bbresc512 Programming 8 05-05-2004 07:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration