"File already exists." while creating class with different name.

Answered

Having trouble creating a new class; it keeps saying "File already exists." while I'm giving it a completely different name.  I deleted the "PresClass" file altogether and when I go to create a new class, no matter what name I give it, IntelliJ will just rename it "PresClass" again; ha.

 

YouTube video here.

 

Hyperlinking of thumbnails, buttons, etc does not work; crazy for coding experts.  Lovely program IntelliJ  is though!

 

0
2 comments

Do you have write permissions in that directory? Could it be that the operation is blocked by some external tool, like an antivirus?

Also, did you modify the new class and header templates? Does it help if you revert them back to the defaults?

Share idea.log (https://intellij-support.jetbrains.com/hc/articles/207241085) and your IDE settings (File | Export Settings): https://intellij-support.jetbrains.com/hc/articles/206869619.

0
Avatar
Permanently deleted user

^Yup; I'm an idiot; I set the default class template to name the public class:

//***************************************************************************
// Kevin ${DATE}
// Lab/Homework # -- Problem # --
//***************************************************************************
import java.util*;

public class PresClass {
public static void main(String[] args) {


}
}

When it should have been:

//***************************************************************************
// Kevin ${DATE}
// Lab/Homework # -- Problem # --
//***************************************************************************
import java.util*;

public class ${NAME} {
public static void main(String[] args) {


}
}

Thank for looking out Mr. Baranov!

0

Please sign in to leave a comment.