Search code examples
javaintellij-ideacompiler-errorsminecraft

The file in the editor is not runnable - IntelliJ


i reinstalled the whole windows system because of a trojan that i had. I installed java JDK 21, as i need it to code minecraft plugins.

I installed the plugin MinecraftDevelopment as usual, done everything the same way i'd do it before reinstalling windows, but when i create a new project the run button is grayed out, and if i hover on it it says "the file in the editor is not runnable". Even by opening a project that i used to work on before resetting, the error i get is the same. What am i missing?

I tried setting the folder src as root, invalidating cache, repairing IDE, making new project, reinstalling intellij, importing spigot manually,. but nothing seems to be working.

IntelliJ screenshot


Solution

  • It looks like you have not added a run configuration.

    For a Spigot plugin, you can use mvn clean package to build a jar and install it by moving the jar to the plugins folder of your server.

    You can add mvn clean package as a Maven run configuration so that clicking on the run button builds the jar.

    Click on the "Current File" dropdown and select "Edit Configurations"

    enter image description here

    Then add a new configuration using the Maven template. Write clean package in the box under "Run".

    enter image description here

    Then you can select the newly added run configuration using the dropdown and the run button will be enabled.