20

I am developing a GWT application on my Mac and now I'm supposed to test it in IE on my PC.

However, I don't want to copy the codes to PC in order to rebuild the project and finally to test it.
Nor do I want to setup the whole Apache + Tomcat server on my Mac to deploy the project so that my PC can access that web application.

Is there any way I can run my GWT application in debug mode on my Mac, and just test it out in IE on my PC? I'm using Spring + Maven + Eclipse + GWT.

andr
  • 15,970
  • 10
  • 45
  • 59
user468587
  • 4,799
  • 24
  • 67
  • 124

4 Answers4

29

In your run configuration of eclipse use -bindAddress 0.0.0.0 and this allow jetty to receive traffic from outside localhost.

In the Eclipse menu

  1. Run > Debug Configurations...
  2. Confirm your project is selected left under Web Applications > Project Name
  3. Select the Arguments Tab on the right panel
  4. Under "Program Arguments:" append the argument "-bindAddress 0.0.0.0"

From there you can debug from a remote machine in Development Mode

Patrick
  • 651
  • 6
  • 14
  • yeah, i tried that, it didn't work, i still can have it running in dev mode: http://127.0.0.1:8888/index.html?gwt.codesvr=127.0.0.1:9997, but if i replaced the 127.0.0.1 with my mac's IP, it don't work, not to mention to remotely access it from PC – user468587 Dec 16 '10 at 23:48
  • When I start an example application with the above steps my address changes from the localhost to my public ip as you can see 192.168.0.103:8888/Bind_Test.html?gwt.codesvr=192.168.0.103:9997 – Patrick Dec 17 '10 at 04:55
  • i m not sure if i made this clear, i have a gwt application working, now i need to view the app in different browsers on different machie to see if the layout/funcationality works well, i don't mean to debug it from a remote machine in Dev mode... – user468587 Dec 17 '10 at 05:30
  • If the Windows machine and the Mac are on the same network then this will work, if you don't want debugging then you can do the same thing under run configurations. If your windows machine can not communicate with the mac then there is no way around it. You will need to compile the GWT code to JavaScript and deploy the war to a servlet container that the windows machine can talk to. – Patrick Dec 17 '10 at 06:22
  • @user468587: What you want to do is absolutely possible - I've accessed my (Mac) development mode GWT apps from browsers on other machines (Win, Linux) numerous times. @Kodova's "-bindAddress 0.0.0.0" is necessary to do that. Also make sure that your firewall allows access (note, that a firewall can even block access from the same machine). Also make sure, that the ip address you're using is the address for the correct network interface. Use `ifconfig` in a terminal to find out all the assigned ip addresses (e.g. maybe it shows `inet 192.168.1.2` and `inet 10.0.0.5`). – Chris Lercher Dec 17 '10 at 11:39
  • @Chris, thanks for the hint! i have my Mac's firewall turned off to make sure it allows any connection from other pc, and in my maven file i defined: -Dgwt.bindAddress=0.0.0.0 ..., started the gwt app, then on my PC, i brought up IE, and typed in http://10.7.1.116:8888/index.html?gwt.codesvr=10.7.1.116:9997, where 10.7.1.116 is my Mac's IP which i got from the output of ifconfig, still it showed nothing..do you know what might be wrong? i m using gwt 2.0.4. thanks! – user468587 Dec 17 '10 at 17:12
  • @user468587: Not sure, if `-Dgwt.bindAddress=0.0.0.0` works at all? I'm using `-bindAddress=0.0.0.0` instead. / I'm not using Maven for the build, so I'm not sure how to specify it correctly there - but it's a *program* arg, not a *JVM* arg, so `` is probably not the correct place to specify it. – Chris Lercher Dec 17 '10 at 18:18
  • i finally got it work, in our project, we used gwt-maven-plugin version 1.2, all i need to do is to add: 0.0.0.0 in the pom.xml then it works! thanks for the help! – user468587 Dec 20 '10 at 16:39
  • 2
    oops, version 1.2 doesn't support option, so googled around and fix is option, we embedded the -bindAddress parameter in the to trick maven to run with the -bindAddress: INFO' -bindAddress 0.0.0.0 -logLevel 'INFO. when u run maven from the command line and observe the maven output, u should see sth like this : ..-loglevel info -bindAddress 0.0.0.0 -loglevel info. for gwt-maven-plugin version 2.1, options is supported, check here: http://mojo.codehaus.org/gwt-maven-plugin/eclipse-mojo.html. The End. – user468587 Dec 20 '10 at 17:43
  • Simply adding `-bindAddress 0.0.0.0` worked like a charm for me – Yuriy Nakonechnyy Mar 26 '14 at 10:52
3

set -bindAddress 0.0.0.0 in (x)=Arguments tab in "Run Configuration" as stated above. when you run your application GWT will use your computer IP in launch URL. after opening the URL in your browser, click on GWT toolbox on the right of Chrome address bar which will open "GWT Developer Plugin Options". now just add your IP to the list of webserver exceptions.GWT Developer Plugin Options

Sameeh Harfoush
  • 610
  • 1
  • 8
  • 22
2

See Debug GWT application in a remote browser.

Community
  • 1
  • 1
z00bs
  • 7,518
  • 4
  • 34
  • 53
1

for maven, you can run as

mvn gwt:run -Dgwt.bindAddress=0.0.0.0
turtledove
  • 25,464
  • 3
  • 23
  • 20