how to clean up unused java file in eclipse

Discussion in 'Java' started by mcheung63@gmail.com, Dec 27, 2012.

  1. Guest

    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 ()
    , Dec 27, 2012
    #1
    1. Advertising

  2. Joerg Meier Guest

    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.
    Joerg Meier, Dec 27, 2012
    #2
    1. Advertising

  3. Lew Guest

    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
    Lew, Dec 27, 2012
    #3
  4. Arne Vajhøj Guest

    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
    Arne Vajhøj, Dec 27, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    6,736
    Chris Smith
    Nov 2, 2005
  2. Charles Sullivan

    Clean up "unused parameter" compiler warnings?

    Charles Sullivan, Sep 5, 2006, in forum: C Programming
    Replies:
    11
    Views:
    569
    Thad Smith
    Sep 11, 2006
  3. Replies:
    1
    Views:
    711
  4. Replies:
    8
    Views:
    498
  5. Greg Willits

    file.seek and unused bytes

    Greg Willits, Jul 3, 2009, in forum: Ruby
    Replies:
    39
    Views:
    445
    Joel VanderWerf
    Jul 7, 2009
Loading...

Share This Page