Pure GWT Project integrated with Dynamic Web Project in Eclipse. Let's CRUD.
Follow Steps and Run GWT project without any issue
1.Java SDK version 1.6 or later
2.Apache Ant is also necessary to run command line arguments. If you don’t already have it, install, or download Apache Tomcat 7.0 or later
3.Download and Install the GWT SDK[ 2.7.0 is latest version till now ] [ Most Important ] - This contains the core libraries, compiler, and development server that you need to write web applications
4.Eclipse (Juno, Mars, Neon, Any!!!) I prefer Mars.
5.mysql-connector-java-5.X.X-bin.jar [ Latest JAR is better ]
NOTE : Sometimes you may face problems regarding GWT COMPILING and Run on GWT Web Application, Sometimes it works fine and sometimes it won't run perfectly (Try step 12, It will work).
So Solution is here, Follow below steps
- Open Eclipse and Create new project > Dynamic Web Application, After that open "webcontent" from project explorer and find folder "WEB-INF",right click on "WEB-INF" > new > folder or press CTRL+N > folder, Give name "classes" [ Must ]
- Right click on Project and Go to Properties or press ALT+ENTER, find Google from left navigator panel. Click on "Web Application" and do check "This Project has war directory", In War directory choose path to webcontent of your project.
- After that click on "Web Toolkit", it is also inside "Google tab", click on "Use GWT"
- Now goto "JAVA BUILD PATH" from left navigator panel and click on "SOURCE"[ first tab by default ] > do check on "Allow output folder" > Now Navigate through classes using browse button > And click Apply
- Now move to libraries tab and click on "Add library" > Select GWT and press "Next" > "Finish" , You can also add JARs from "Add JARs" or "Add External JARs" as well
- Next tab that is "Order and export", go there and click on selectAll > Apply > ok
- Hurray !!! You are ready to making your application, But before that make 4 folders
1.com.example : It is for Entry point
2.com.example.client : It is for client side coding or you can say UI part
3.com.example.server : It is for server side coding or you can say backend coding part
4.com.example.shared : It is shared package. You can keep POJO(s), Validators or anything which you want to use as shared resource. - Now Locate path : Project explorer > Project > WebContent > WEB-INF > web.xml, to make an entry/mapping for @RemoteServiceRelativePath("someName"), which I have mentioned in above files [ Download and Extract zip, In eclipse You can Import As well ]
- Ok Done. Now its important step: Select Project > Right click > Google > GWT Compile => It will take few time to complete permutations
- After compilation > Right click on Project > Run As > Run on Server
- It will appear in Browser. If you can't see anything then press CTRL+F5 to reload. UI will be display on screen.
- When you Recompile it, Project will working fine but if you get any problem or error thing, Please delete this two directory from your Project > 1. Project/gwt-unitcache and 2. Project/webcontent/projectname [ Reason :I suggest this. Because I faced error many times and this one will be consider as a solution for successful compiling ]
- Now follow step 9 - 10 - 11 and enjoy.
If you have any query, Feel free to ask !
Email Id : Rakshitshah1994@gmail.com