Adding Java packages to GWT

前端 未结 2 1012
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 11:30

I\'ve tried searching but couldn\'t come up with a defined way on how to add your own packages to a GWT project.

My tree structure looks like this:

-com.         


        
2条回答
  •  迷失自我
    2021-02-08 12:22

    You can get rid of the two source path lines, because by default GWT will pick up anything that is relative to the root, and in the client package like you have. You also need to move your gui package into your client package, so it would become:

    -com.mycompany
      -public
        MyApplication.html
      MyApplication.gwt.xml
    
    
    -com.mycompany.client
      MyApp.java
    
    -com.mycompany.client.gui
      TableLayout.java
    
    
    
      
      
    
    

    Assuming your MyApp.java is an actual EntryPoint, then this should work just fine.

    One other thing to note is that you cannot use java classes that are not part of the GWT JRE Emulation library, and your project won't compile if you do. You should get very specific errors about this though. For example you cannot use library classes like java.math.BigDecimal, if they are not emulated. All of your own classes you create can be used though.

提交回复
热议问题