Netbeans cached an deleted class and does not recognize another class

Asked

Viewed 726 times

-2

I have different packages in my project, and by mistake I ended up creating two classes with the same name, let’s assume Aluno.java, but in different packages.

I deleted one of them, and even after clearing the Netbeans cache, it no longer finds the Student.java class left in the project.

It does not suggest it in the "import br.com.meuprojeto.util [...]" autocomplete and even after clearing the IDE’s cache, I still can’t import the class.

EDIT: Exemplifying the problem better. Have an abstract Student.java class and I want to extend classes from it. It turns out that, by mistake, I ended up creating another class called Student.java in another package of the project.

I deleted this second class created by mistake, but the Netbeans IDE seems to me that I don’t understand any references to Student.java, that is, the first Student.java class of the project still exists but when I add a "extends Student" to my project, it does not find within my project this class and in the class Imports listing, the "import br.com.meuprojeto.util" shows Warning, even if that is the correct path from where the abstract class is. As a test, I created an abstract Newaluno.java class, and he understood it perfectly.

  • I tried to clear the Netbeans V8.1 cache by deleting the /Cache/8.1 folder it is in, but it didn’t work.

  • I deleted my project from the machine, deleted the folder again, restarted the machine, cloned the project again, and still do not understand the reference.

Now I uninstalled Netbeans, I will restart the machine and install Netbeans again. I hope that in this way the IDE cache will be properly cleared, as all other attempts have been failed.

EDIT 2 : Worse still uninstall. Netbeans does not erase all folders and files it uses. I’m trying to reinstall but now has stopped the installation and will not. It was stopped at 0%. That is, if the IDE bugged, will be bugged forever rs. Clearing the cache is no use, closing the project and cloning everything is no use either because the problem is in the IDE, reinstalling is no use because it still doesn’t erase everything from your computer and try to install again even worse, because it gets stuck and won’t go.

EDIT 3: Source code, as requested. The code is a Jframe class that extends the abstract class Student.java. I’m doing a Java Swing project, and the abstract class Aluno.java brings some important definitions to the project and by default, I need the Jframe screens to extend from Aluno.java . If I create a Newaluno.java class, Netbeans understands the existence of this class normally (or rather, understood... because now q uninstalled, got worse, I’m not working, as I wrote there in EDIT 2 above). But I can’t refactor all the screens to extend from Newaluno.java, because the problem is clearly in my machine since my project colleagues had no problem with this. I need somehow to get Netbeans back to seeing the existence of the original Student.java class..

package br.com.meuprojeto.views;

/*A classe existe neste caminho, porém fica com warning no import,
 e como solução o Netbeans oferece: 'Importar de excluido'*/

import br.com.meuprojeto.util.Aluno; 
import javax.swing.ImageIcon;
import org.json.JSONObject;

public class Janela1 extends Aluno{

/**
 * Creates new form Janela1
 */
public Janela1() {
    initComponents();
}
  • Right. I have a Student.java class, and it’s an abstract class, and I want to extend classes from it. It turns out that, by mistake, I ended up creating another class called Student.java in another package of the project. I deleted this second class created by mistake, but the Netbeans IDE seems to me that I don’t understand any references to Student.java, that is, the first Student.java class of the project still exists but when I add a "extends Student" to my project, it does not find within my project this class and in the class Imports listing, the "import br.projecto.student.Student" shows Warning

  • Okay, include an excerpt of the code.

  • What do you mean a screen extends an object? That’s a little strange isn’t it? Or a window is a kind of student?

  • No, look at that. It is not extending object but the Student class, which is an abstract Jframe, with abstract methods, and when I create new Jframe screens, I need them to be Student extends to implement the methods.

  • This I understood and it doesn’t make much sense. A canvas is always a canvas, shouldn’t it extend a kind of object as it was made, it’s like you’re saying a canvas is a kind of student, makes sense? Well, I’m not going to dwell because the question was not even about that, and also not to distort your question.

  • You’re using Maven to manage dependencies?

  • I understand your question. It is that the screens of my project look for information to fill tables and other components through some methods request Json, so I standardize through Student, so the frames will always work the same way, with the same requests. Makes sense now?

  • No, it hasn’t made sense to me yet, but if it works perfectly for you, who am I to say if it’s wrong or not.

Show 3 more comments

1 answer

2


The solution I had for the Netbeans cache problem was:

  • Uninstall the Netbeans IDE

  • Delete Netbeans C Directories: Users Appdata Roaming and C Users Appdata Local

  • Delete the folders . nbi and . netbeans-derby in C: User user, and delete the C: Program Files folder Netbeans 8.1

  • Reinstall the Netbeans IDE

Browser other questions tagged

You are not signed in. Login or sign up in order to post.