Sharing Local GWT Project with the rest of the world?
As you all probably know, when you create a GWT project (I use Eclipse..not that it matters), and you run it as a web application, you get the application URL, for instance: http://127.0.0.1:8888/StockWatcher.html?gwt.codesvr=127.0.0.1:9997
My question is, I would like to let my friend, which is on a different computer, this URL so he can also check the applica开发者_Go百科tion, so I changed the 127.0.0.1's to my own IP, but it doesnt do the trick, what am I missing here?
Thanks,
If you want to share your app with rest of the world, you need to deploy it on some sort of web server. You can pick many of them, f.e. Apache Tomcat, Jetty, JBoss, GlassFish ... Basically, your application needs some sort of container to run in.
I will now briefly describe deploying GWT app to Tomcat:
- You must have globaly accessible IP (and also domain name)
- Install Apache Tomcat, see the documentation
- Eclipse with Google plugin created for you folder structure containg /war folder
- Copy /war folder to to Tomcat webapps (by default /Apache Tomcat X/webapps. You might want to rename your war folder, say to "StockWatcher"
- Add necessary libraries to /lib folder (but Tomcat will complain about missing classes, not difficult to find out what's wrong here)
- Restart tomcat and type URL like:
http://your_url:your_port/YourApp/YourApp.html
I see that you did StockWatcher tutorial, these steps should cover basics. Try it on localhost first. Maybe getting globaly accessible IP is what you were originaly looking for.
The URL you pasted is the "development mode" (or "hosted mode") URL for debugging your app. For deployment, you need to compile your project (in Eclipse there's a red-colored button, and see the GWT website for more details).
If all you want is for your friend to access your debugging development run, see GWT's docs about that
pass the parameter -bindAddress 0.0.0.0 to bind the embedded server from eclipse to all network cards. compile your app with the red icon in eclipse and paste the url from the dev console without gwt.codesrv at the end
In Eclipse, Run > Debug Configurations... Select your project on the left panelunder Web Applications > Project Name Select the Arguments Tab on the right panel Under "Program Arguments:" append the argument "-bindAddress a.b.c.d" where a.b.c.d is the IP of your machine. Restart/Run jetty Now the URL can be accessed from a different machine on the network
精彩评论