MinecraftForge/ForgeGradle

IntelliJ Class not found bug

Opened this issue ยท 14 comments

Whenever I try to run Sponge through IntellijIDEA (Latest version) I get this error

Exception in thread "main" java.lang.ClassNotFoundException: GradleStartServer
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)

you probably have the run configurations set for the wrong module.
see #351

I still don;t understand what I'm supposed to do to resolve this.

liach commented

Run gradlew runClient for now.

liach commented

@AbrarSyed I meet this problem too, it says something like GradleStart is not in classpath.

Yal need to learn to use your chosen IDE. Inyelloj 2016 made it so that a standard gradle project has 3 modules. Project, project-main, and project-test.
The run configurations are targetting the 'project' module instead of 'project-main'.

liach commented

Oh thanks.

I wasn't aware of that addition to IntellijJ thank you Abrar :)

liach commented

By the way @AbrarSyed how to launch dev inv with test mods for forge? I could only launch without test mods.

For those using IntelliJ to correct this error:

After you have setup your project and run the 'genIntellijRuns' task from Gradle panel

  1. Select the 'Run' menu
  2. Select 'Edit Configurations...'
  3. In the navigation tree select 'Minecraft Client'
  4. for the value of 'Use classpath of module' change the value from '[YourModName]' to '[YourModName]_main'.
  5. Click 'Apply'
  6. In the navigation tree select 'Minecraft Server'
  7. for the value of 'Use classpath of module' change the value from '[YourModName]' to '[YourModName]_main'.
  8. Click 'Apply'

Tested using Intellij 2016.1.3 and the 10.2 experimental mdk

@shaneknysh when i click on "Use classpath of module" i do not get [modname]_main in the dropdown menu at all. The only two choises i get is "" and "[modname]"

liach commented

@RexTheCapt Because you need to separate each source set into a module when you import

@liach how do i do that?

liach commented

@RexTheCapt https://youtu.be/G2aPT36kf60
I am too lazy to explain.

Closing this issue as it does not appear to be applicable to the currently supported ForgeGradle branch (FG_3.0).

If I am incorrect in this regard, please create a new issue prefixed with [FG_3.0] and containing:

  • A summary of the issue (in case the issue has mutated slightly or the original report was poorly described)
  • Steps to recreate the issue
  • Console output or logs (if possible)

Note that an ongoing effort to update legacy MinecraftForge branches to utilize FG_3.0 is ongoing and accepting informed contributions. (For more information join the Discord and read through the #mcpconfig channel)