0

We have about 280 Java source code spread over 10 packages, and a bunch of txt and image files for a software project. Quite a few of them are not being used currently. They do not break the system, since we can just do a "javac //*.java" and "jar cmf metafile " to build up the executable jar which works. The question:

How do we find the class files never accessed, or image/txt files never used as resources in the jar?

Manidip Sengupta
  • 3,573
  • 5
  • 25
  • 27

3 Answers3

1

It would be very hard to determine which image/txt files are never used, as they can be loaded in a variety of manners. A good bet for the image/txt files is to search for the name of each file in your code; if it is not there, it might not be being used; remember, the name of the file could be being generated programmatically and then loaded.

I recently had to do something similar for a game project. Because content could be brought in via a variety of means, removing unused content took a lot of trial and error.

There are plugins for eclipse that can find unused code.

James
  • 5,355
  • 2
  • 18
  • 30
0

It has been answered in How to find unused/dead code in java projects.

For the images, I would write a small program, pseudocode would look like:

//list image names
//for each image name
    //find ocurrences in other files
Community
  • 1
  • 1
adrianboimvaser
  • 2,651
  • 1
  • 22
  • 30
0

Use the Unused Code detector: http://www.ucdetector.org/

Daniel
  • 27,718
  • 20
  • 89
  • 133