Reputation: 21
I have started java a week ago and I am trying to make a Minecraft plugin but it is not working. In the tutorial I'm watching the guy says to run the script to get a .jar file for it, the problem is that I can't press the run button (on IntelliJ) because it says "The file in the editor is not runnable". I think I know the reason but I still can't fix it. I think the problem is that I need a file for it to run off but nothing showing up (blue circle). Can anyone help?
I couldn't find anything similar and even asked some friends I know that are a bit more experienced but we couldn't anything that helped.
Upvotes: 1
Views: 720
Reputation: 11554
IntelliJ has a few things that can affect a file not being able to be run.
Missing SDK configuration. If you don't have a Java version selected for the project, the file can't be executed.
Missing Sources Root. IntelliJ only allows a file to be run if it is part of the source code for the project. In maven, the directory src/main/java
is marked as the Sources Root.
To see what directory is marked as the Sources Root you can open the Project Structure dialog and click on the Modules tab and you'll see this configuration.
Another way you can do this is by right clicking on a folder and selecting Sources Root.
Upvotes: 0
Reputation: 1
I had the same problem.
If you press on the "Current File" where the run button is, and press "Add new run configuration" then press "Maven" then you should be able to run it. I don't know why, but it worked for me. Good luck!
Upvotes: 0
Reputation: 31
If you have not done so yet, install the plugin "Minecraft Development" it helps you set up dependencies and all the other things you need for minecraft plugins. After that, just create a new project with the plugin.
Upvotes: 1
Reputation: 1
Do you see "Maven" on the right side of your screen? Click and choose on your plugin Name, then "Lifecycle" and after this click "Package". Grab your compiled plugin in Project "target" folder.
Upvotes: 0