Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 570769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:26:13+00:00 2026-05-13T13:26:13+00:00

I have a project created by others that includes thousands of class files and

  • 0

I have a project created by others that includes thousands of class files and has the package names explicitly typed out for every reference to any of their classes. It looks like the code was reverse engineered. Is there a good tool for Java that refactors the code so that the explicitly typed package prefixes are removed from class references and moved into import statements.

Thank you in advance.

EDIT:

I think an example will help. I want to have the imports at the top, and I don’t care how many imports there are.

javax.swing.JButton button1 = new javax.swing.JButton();

Imagine the code above but absolutely everywhere in thousands upon thousands of lines of code amongst thousands of class files. I would like to be able to remove all of the prefixes and just have a nice import javax.swing.JButton; at the top of each class file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:26:14+00:00Added an answer on May 13, 2026 at 1:26 pm

    I don’t know a tool for this use case, but I had to do something similar a few month ago.

    • Write a script or do a search replace with regex to get rid of the explicitly typed package prefixes.

    • Than let eclipse do the rest using “organize imports”. Ctrl-1

    Hint: to avoid ambiguities, setup the classpath with no more than the required libs.
    For sround about 800 classes I was done in 2 hours.

    • Or get someone who deserved it to do this job.

    EDIT: You should know that in Prefeneces/Java/Editor/Save Actions, Organize imports can be configured as save action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a project that uses scala that has some abstract classes definitions
I have a project that includes files from a different project. I am getting
I have a project that includes some Java APIs, some resource files, and some
I have included Zend in my project and this library has about 2.8k files.
I have a project created in visual studios 2010 pro, now opening it ultimate
We have an ADP project created several years ago using Access 2000. This project
I have a simple asp.net MVC4 / EF 4.1 project created with VS 2011,
I have created a project in Dashcode, inserted a List control, enabled a dynamic
I have created SSRS project in BIDS and I want to use the reports
i have one doubt,i have created new project in eclipse with android 2.3.1 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.