Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Unable to Create Working .jar
Unable to Create Working .jar [message #845886] Sun, 15 April 2012 14:13 Go to next message
Andrew Barrell is currently offline Andrew BarrellFriend
Messages: 2
Registered: April 2012
Junior Member
I have finally finished a project I've been working on for a couple of days and when trying to export it into a executable .jar file it doesn't work how it is supposed to (the frame is black as it is supposed to be, however the yellow ball does not appear as it does when running it from inside eclipse).

Could you please help me in figuring out what I am doing wrong? I have toyed around with it for an hour and searched youtube and other forums for the solution to no avail.

I will attach the image used and the two .java classes to this thread to allow someone to check if the layout is correct. To add the image I right clicked on the project, -> Add New File. Renamed it ballImage and put the image called "ball.png" into it.

I use Eclipse Indigo.

Thank you,
~Andrew
  • Attachment: ball.png
    (Size: 0.28KB, Downloaded 156 times)
  • Attachment: Ball.java
    (Size: 2.29KB, Downloaded 281 times)
  • Attachment: Bouncing_Ball.java
    (Size: 0.94KB, Downloaded 197 times)
Re: Unable to Create Working .jar [message #846044 is a reply to message #845886] Sun, 15 April 2012 17:54 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2012.04.15 8:13, Andrew Barrell wrote:
> I have finally finished a project I've been working on for a couple of days and when trying to export it into a executable .jar file it doesn't work how it is supposed to (the frame is black as it is supposed to be, however the yellow ball does not appear as it does when running it from inside eclipse).
>
> Could you please help me in figuring out what I am doing wrong? I have toyed around with it for an hour and searched youtube and other forums for the solution to no avail.
>
> I will attach the image used and the two .java classes to this thread to allow someone to check if the layout is correct. To add the image I right clicked on the project, -> Add New File. Renamed it ballImage and put the image called "ball.png" into it.
>
> I use Eclipse Indigo.
>
> Thank you,
> ~Andrew

The problem's not going to be in the source files themselves, but in
your creating a proper JAR including them and the AWT and other
libraries on which they depend.
Re: Unable to Create Working .jar [message #846052 is a reply to message #846044] Sun, 15 April 2012 18:07 Go to previous messageGo to next message
Andrew Barrell is currently offline Andrew BarrellFriend
Messages: 2
Registered: April 2012
Junior Member
I'm quite new to all of this to be honest but I followed some tutorials on youtube to a tee and they still didn't solve it. When I extracted the .jar it had all the files (seemingly) in the .jar so I don't understand why its not working out. Do you have any idea how I can fix it, or what I can do different, what options I'm not selecting etc

~Andrew
Re: Unable to Create Working .jar [message #846249 is a reply to message #846052] Sun, 15 April 2012 22:59 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2012.04.15 12:07, Andrew Barrell wrote:
> I'm quite new to all of this to be honest but I followed some tutorials
> on youtube to a tee and they still didn't solve it. When I extracted the
> .jar it had all the files (seemingly) in the .jar so I don't understand
> why its not working out. Do you have any idea how I can fix it, or what
> I can do different, what options I'm not selecting etc
>
> ~Andrew

You can either embed the supporting JARs in the JAR you generate, or
reference the class path to the additional JARs you need on the command
line:

$ java -classpath "libs/:" YourApplication.jar

I assume that in YourApplication.jar you've got all three files where
they need to be since you used Eclipse Export... to create it.
Previous Topic:wav files not showing when jar file is executed
Next Topic:Problem opening newly installed Eclipse 3.7.2 in Fedora 16
Goto Forum:
  


Current Time: Fri Apr 26 12:04:57 GMT 2024

Powered by FUDForum. Page generated in 0.10296 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top