Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to create runnable JAR in Eclipse
How to create runnable JAR in Eclipse [message #531924] Thu, 06 May 2010 10:26 Go to next message
Eclipse UserFriend
I have a project in Eclipse with many classes.

Whenever I try to create a runnable JAR, the JAR file created always contains all the classes of the project, regardless whether they are really used or not.

Is it possible to create a runnable JAR in Eclipse, excluding the classes of the project which are not strictly necessary for a given launch configuration?
Re: How to create runnable JAR in Eclipse [message #531974 is a reply to message #531924] Thu, 06 May 2010 12:07 Go to previous messageGo to next message
Eclipse UserFriend
Thu, 06 May 2010 10:26:43 -0400, /Krige/:

> I have a project in Eclipse with many classes.
>
> Whenever I try to create a runnable JAR, the JAR file created always
> contains all the classes of the project, regardless whether they are
> really used or not.
>
> Is it possible to create a runnable JAR in Eclipse, excluding the
> classes of the project which are not strictly necessary for a given
> launch configuration?

Eclipse projects are generally meant as atomic modules. The "JAR
Export" as opposed to "Runnable JAR file" allows you to select
individual resources you want exported. You can specify the Main
class (the runnable one) with it also.

--
Stanimir
Re: How to create runnable JAR in Eclipse [message #531975 is a reply to message #531974] Thu, 06 May 2010 12:12 Go to previous messageGo to next message
Eclipse UserFriend
Stanimir Stamenkov wrote on Thu, 06 May 2010 12:07
Eclipse projects are generally meant as atomic modules. The "JAR
Export" as opposed to "Runnable JAR file" allows you to select
individual resources you want exported. You can specify the Main
class (the runnable one) with it also.


Thank you Stanimir. The problem is that there may be too many needed resources so I can't select them one by one. I hoped Eclipse would be able to automatically detect the ones needed.
Re: How to create runnable JAR in Eclipse [message #531987 is a reply to message #531975] Thu, 06 May 2010 13:13 Go to previous message
Eclipse UserFriend
Thu, 06 May 2010 12:12:22 -0400, /Krige/:

> Thank you Stanimir. The problem is that there may be too many needed
> resources so I can't select them one by one. I hoped Eclipse would be
> able to automatically detect the ones needed.

I don't think that's possible, e.g. code accessed through reflection
could not be detected reliably. So you might consider and organize
your code into distinct atomic modules/projects where you package
everything as whole.

--
Stanimir
Previous Topic:NPE within CodeFormatter
Next Topic:Globally detecting double click in editor
Goto Forum:
  


Current Time: Mon Mar 17 02:08:13 EDT 2025

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

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

Back to the top