Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > how to clean up unused java file in eclipse

Reply
Thread Tools

how to clean up unused java file in eclipse

 
 
mcheung63@gmail.com
Guest
Posts: n/a
 
      12-27-2012
Dear All
I have a project in eclipse, it has many java files, they are taken from an open source project. I will call one single function from one class, how can i clear out all unused classes?
thanks
from Peter ()
 
Reply With Quote
 
 
 
 
Joerg Meier
Guest
Posts: n/a
 
      12-27-2012
On Wed, 26 Dec 2012 20:44:51 -0800 (PST), wrote:

> Dear All
> I have a project in eclipse, it has many java files, they are taken from an open source project. I will call one single function from one class, how can i clear out all unused classes?
> thanks


Select the files you don't want and press the Delete key. There is no
automatic way to do what you want. An optimizer/shrinker such as ProGuard
can be used to clean away unused classes from your compiled output, but its
use is not trivial.

Also, just because you only call one function doesn't mean no other classes
are needed - the function or the class holding the function itself might
reference a multitude of classes, possibly even all of them.

Liebe Gruesse,
Joerg

--
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      12-27-2012
mche...
> I have a project in eclipse, it has many java [sic] files, they are taken
> from an open source project. I will call one single function from one class,
> how can i [sic] clear out all unused classes?


By not copying them into your project.

However, this is both not the right way to do it nearly always, and risks
your violation of license terms. Check with a lawyer to ensure that you comply
with the open-source license.

Your question is rather odd. What one function from what one class is so
valuable that you'd lift it, and what open-source project has such a gem
yet none of its other functionality will serve?

Why not just add the JAR to your libraries? What's the big deal?

--
Lew
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      12-27-2012
On 12/26/2012 11:44 PM, wrote:
> Dear All I have a project in eclipse, it has many java files, they
> are taken from an open source project. I will call one single
> function from one class, how can i clear out all unused classes?


That will become a maintenance burden.

I would just have the calling project have the jar
file with the binary of the entire open source thing in
classpath.

That makes upgrade easy (assuming the function you use
has not changed).

And the jar file will typical just be a few hundred
KB. If that is a problem due to unusual constraints
then look for one of the obfuscator tools that
removes unused binary code.

Putting part of the source code of the open source
project in your project tree will make it cumbersome
to upgrade.

Arne

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Clean up "unused parameter" compiler warnings? Charles Sullivan C Programming 11 09-11-2006 09:34 AM
How do I clean a virus within an inbox or just clean only that infectedattachment or LOCATE AND delete just that attachment ? Vinayak Firefox 1 08-14-2006 06:19 PM
Eclipse - plugin to find unused CLASS MEMBER VARIABLES? steve.chambers@gmail.com Java 5 11-02-2005 03:33 PM
Clean up my Hard drive before selling it. Clean Registry? what else? baaab Computer Support 5 05-10-2005 08:30 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57