Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   how to clean up unused java file in eclipse (http://www.velocityreviews.com/forums/t955853-how-to-clean-up-unused-java-file-in-eclipse.html)

mcheung63@gmail.com 12-27-2012 04:44 AM

how to clean up unused java file in eclipse
 
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 (cmk128@hotmail.com)

Joerg Meier 12-27-2012 01:34 PM

Re: how to clean up unused java file in eclipse
 
On Wed, 26 Dec 2012 20:44:51 -0800 (PST), mcheung63@gmail.com 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.

Lew 12-27-2012 07:07 PM

Re: how to clean up unused java file in eclipse
 
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

Arne Vajh°j 12-27-2012 07:15 PM

Re: how to clean up unused java file in eclipse
 
On 12/26/2012 11:44 PM, mcheung63@gmail.com 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



All times are GMT. The time now is 03:20 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.