0

OS: Windows 10 x64 SDK: JDK 16.0.2 Platforms: IntelliJ IDEA Ultimate 2021.3.2 and Eclipse 2021-12 (4.22.0)

I have a strange problem that has me utterly confused and I'm not really sure how to get about with it. I have a Maven project with JUnit on IntelliJ IDEA 2021.3.2, with a GUI built through IntelliJ's Form Builder tool. The generating GUI setting is switched to "Java Source Code".

enter image description here

The nature of my work (college work) means I need to have an eclipse compatible version of the project for review by someone, which I'm doing through the "File > Export > Export to Eclipse" button. When the project is built, IntelliJ starts throwing errors about it being "Unable to resolve symbol: intellij", which is referenced here: IntelliJ inspection gives "Cannot resolve symbol" but still compiles code. I've tried all the answers listed in this question however none of them have been able to get rid of these errors, despite it compiling and running just fine through IntelliJ. The problem arises when I import the project into Eclipse for testing, where it immediately throws a variety of errors which IntelliJ doesn't pick up running on there:

Exception "java.lang.ClassNotFoundException: com/intellij/openapi/editor/RawText"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.openapi.editor.RawText
Exception "java.lang.ClassNotFoundException: com/intellij/openapi/editor/RawText"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.openapi.editor.RawText
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems: 
    com.intellij cannot be resolved to a type
    com.intellij cannot be resolved to a type
    com.intellij cannot be resolved to a type
    com.intellij.uiDesigner.core.GridConstraints cannot be resolved to a type
    com.intellij.uiDesigner.core.GridConstraints cannot be resolved to a variable

After this appears in Eclipse, it instantly begins appearing in IntelliJ of which I can't seem to find a solution to anywhere, forcing me to reimport the project which'll only result in the same error happening again the next time I need to run it through Eclipse. Does anyone have any idea what's going on here?

EDIT: I just discovered if I delete the target folder it makes after running on eclipse and rebuilding through intelliJ it'll relaunch just fine on there but will reappear on eclipse if I run it again. Sometimes though, it launches and works without issues? This is somehow getting even more confusing

howlger
  • 31,050
  • 11
  • 59
  • 99
PyxlWuff
  • 101
  • 5
  • 1
    What's that bit about "form runtime classes"? – nitind Mar 01 '22 at 03:28
  • Initially unchecking that caused intelliJ to error out the ass, but a quick recheck and relaunch before unchecking and rebuilding seems to have solved the eclipse issue amazingly?? – PyxlWuff Mar 01 '22 at 03:39
  • Update: I had to restart for an update, and now I'm back at square 1 with the same issue.. again – PyxlWuff Mar 01 '22 at 03:51
  • 1
    it's a Jetbrains specific class, Eclipse knows nothing about it. Ergo, once you use that stuff you can from then on only edit the project from inside IntelliJ. You might be able to RUN the project from Eclipse after it was compiled by IntelliJ (maybe), but not change anything as that would force a recompilation. – jwenting Mar 01 '22 at 04:20

1 Answers1

0

In the end it was found out that a maven dependency was missing that it doesn't seem to add by default when you switch the designer to compile into Java Source Code, as found here.

Adding the following below to my pom.xml and reloading maven solved it, and Eclipse + IntelliJ now behave properly.

    <dependency>
        <groupId>com.intellij</groupId>
        <artifactId>forms_rt</artifactId>
        <version>7.0.3</version>
    </dependency>
PyxlWuff
  • 101
  • 5
  • According to your description it is a bug of IntelliJ, not of Eclipse. You wasted your time by using IntelliJ's GUI Designer that does not add the dependency required by itself, right? – howlger Mar 01 '22 at 15:14