1

I'm developing a plugin for PyCharm. I have created a project in IntelliJ IDEA with some GUI. It automatically created .java file and .form file. Now I need to compile it using command line so I tried javac. My command looks like this:

javac src\*.java -cp libs\openapi.jar;libs\util.jar -d out

It works and compiles with no error. Then I pack it to a jar file using this command:

jar -cf myApp.jar *

It also processes with no problem. But when I try to use the plugin in PyCharm, it throws a NullPointerException on a first place where I use anything from the GUI. The GUI element is called "blabla" and in IDEA it appears like a container containing a class and a form. The class looks like this:

public class blabla implements ToolWindowFactory {

    private JScrollPane myScrollPane;

    public BrowserToolWindowFactory(){
        myScrollPane.setVisible(false);
        myScrollPane.setBorder(null);
.....

So I'm using myScrollPane but it's never initialized, therefore it throws an exception. But I guess it should be initialized using the .form file. When I build the project in IDEA, it works just fine and I can see that compiled file .class contains more stuff then the .class file generated using javac.

Can anybody point me in the right direction? How to resolve this?

Thank you.

zacharmarz
  • 203
  • 1
  • 15
  • 1
    See https://stackoverflow.com/a/10483562/104891 and https://stackoverflow.com/a/44739046/104891. `javac2` is needed to built the code, or you can enable the option to generate sources, build the project in IntelliJ IDEA first so that initialization code is generated into `.java` files, then build using normal `javac`. You will also need `forms_rt.jar` dependency in the classpath. – CrazyCoder Jul 21 '17 at 11:13
  • Thank you very much. This helped me a lot. I was trying to resolve this issue for hours, but couldn't find the posts you mentioned. – zacharmarz Jul 26 '17 at 05:34

0 Answers0