1

I started developing a simple tool on my laptop and wanted to move the project to my PC. Because i use version control I first simply cloned the repo, after that did not work I also tried copying the files.

After fixing some character issues, I get a NullPointerException when initializing my main form. I don't have that exception on my laptop.

I also found out that every single form element in the Java class is initialized to null, even though the form is bound to the class.

Github Repo

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
N0W0RK
  • 51
  • 1
  • 12
  • 2
    Do you build with IntelliJ IDEA or with Gradle? If the latter, UI initialization code will not be instrumented. Switch code generation to the Source files per https://www.jetbrains.com/help/idea/gui-designer.html. Open the project in IntelliJ IDEA, compile it (with gradle delegation disabled and the build set to IntelliJ IDEA: https://i.imgur.com/AmWjMZR.png). Make sure `$$$setupUI$$$` method is generated in the form class file. Now you should be able to build the same project with the command line Gradle as well. – CrazyCoder Sep 19 '19 at 19:20
  • Thank you very much. Would you mind posting this as an answer? Also, is there any way I could have found this myself? – N0W0RK Sep 19 '19 at 19:52
  • Did it solve the issue? Was the problem caused by building from Gradle? – CrazyCoder Sep 19 '19 at 19:54

1 Answers1

10

It's a known issue when the build is delegated to Gradle.

The workaround is to disable the build delegation and switch compilation to IntelliJ IDEA:

No delegation

Another option is to configure Gradle to build the forms, see this answer.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904