In other words, I am asking for an "Idiots guide to start the debugging
mode" for "experienced java programmers".
Thanks in advance,
Nicolas
It can also be made by hand, but you must know all the parameters.
I've followed these steps:
http://code.google.com/webtoolkit/gettingstarted.html#NewEclipse
I suppose the (.cmd) scripts are ment to run/debug in outside Eclipse.
If u r working on GWT and do not know to debug using eclipse, then
chances are there that ur life will become miserable. do not wory, i'll
take u step by step, for ur debugger to hit the breakpoint.
So here is the idiots guide. Well, <app-name>-compile.cmd and
<app-name>-shell.cmd are just normal batch files,
the purpose of <app-name>-compile.cmd is to set the java classpath, for
the needed jars and start the com.google.gwt.dev.GWTCompiler program.
this will generate the neededed javascripts, html and xml from ur
source (src folder). similarly the purpose of <app-name>-shell.cmd is
to set the set the java classpath, for the needed jars and start the
com.google.gwt.dev.GWTShell program, this GWTShell contains the main
method to start the execution of ur GWT app. u can simply copy the
stuff in these cmd files and paste them on the command prompt, u will
see the same effect as double clicking these files.
So now the debugger, the eclipse debugger needs a .launch extension
file in ur project directory something like <app-name>.launch file. If
u use the projectCreator and applicationCreator provided by GWT it will
create the launch files for u. A typical launch file has the following
structure, as given below. U can copy this and use it too :-)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration
type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH"
value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
value="com.google.gwt.dev.GWTShell"/>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS"
value="true"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="<?xml version="1.0"
encoding="UTF-8"?> <runtimeClasspathEntry
containerPath="org.eclipse.jdt.launching.JRE_CONTAINER"
javaProject="ProjectName" path="1"
type="4"/> "/>
<listEntry value="<?xml version="1.0"
encoding="UTF-8"?> <runtimeClasspathEntry
internalArchive="/ProjectName/src" path="3"
type="2"/> "/>
<listEntry value="<?xml version="1.0"
encoding="UTF-8"?> <runtimeClasspathEntry
internalArchive="/ProjectName/classes" path="3"
type="2"/> "/>
<listEntry value="<?xml version="1.0"
encoding="UTF-8"?> <runtimeClasspathEntry
internalArchive="/ProjectName/jars/gwt-dev-windows.jar"
path="3" type="2"/> "/>
<listEntry value="<?xml version="1.0"
encoding="UTF-8"?> <runtimeClasspathEntry
internalArchive="/ProjectName/jars/gwt-user.jar"
path="3" type="2"/> "/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
value="-out www com.xyz.abc.gui/gui.html"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
value="ProjectName"/>
<booleanAttribute
key="org.eclipse.jdt.debug.ui.CONSIDER_INHERITED_MAIN" value="true"/>
<booleanAttribute
key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If u dont want to generate one for u, u can use the above xml script.
Copy it and paste it in a <ProjectName>.launch file and save this file
parallel to ur projects src folder. Change the ProjectName with ur
actual project name, change the classes folder with ur actual output
classes folder. if u have any other jar files to be included do it as
it is done above for gwt-dev-windows.jar and gwt-user.jar
Also change the "www com.xyz.abc.gui/gui.html" with ur module name.
Now start ur eclipse. Open ur project. put a breakpoint somewhere most
likely to hit. click run --> debug --> Java Application --> New .
Now click the check box saying "Include libraries when searching for
the main class" AND click search.
Now select GWTShell from the displayed list --> click apply --> click
debug.
WELCOME to the world of GWT Application debugging.
Hope it was worth writting such a big story.
Sharad
Regards
Saqib Rasheed
I do not see any reason, why ur app does not find the GWTShell, if u
followed above steps thoroughly.
Did u click the check box "Include libraries when searching for the
main class", if u did, then u do not have the gwt-user.jar in ur
classpath.
check the <app-name>.launch file above, and provide correct location of
the jar file.
A typical entry for any jar file should be
<listEntry value="<?xml
version="1.0"encoding="UTF-8"?> <runtimeClasspathEntry
internalArchive=
"/ProjectName/jars/gwt-user.jar"path="3"
type="2"/> "/>
Here /ProjectName is the name of ur eclipse project. Also check whether
ur module description file (xyz.gwt.xml) is mapped properly.
generate ur project structure with the applicationCreatoe and
projectCreator tools and Follow the above steps again.
HTH
Sharad
your explanation is really helpful, now i have another question to
debugging. How can i debug the server side app ( for RPC ) unter a GWT
project. Shall i start a second debugger for that, i really want to
debug the GWT app just like a normal desktop app. regardless of it is
the server side code or client side.
BR.
Mat
In Hosted mode u can debug normally, just put a breakpoint at any point
on the server side code which is most likely to hit.
Let the debugger go directly hit the server side breakpoint, do not try
to navigate from one breakpoint on client side to another on the server
side.
In web mode u can use remote debugging to hit the server side
breakpoint directly as if a normal java application debugging.
It is very simple and is explained properly at this link for Tomcat.
http://tomcat.apache.org/faq/development.html
In remote debugging the eclipse debugger is basicaly trying to connect
ur eclipse code to the remote jvm which ur server has started.
Hope this helps.
Sharad
what i actually want to know is the first case of your description, At
the beginn i have also thought so, debugging in hosted Mode just like
normal Java App. but the debugger did stop at the server side
breakpoint. Maybe there is some bugs in my code, now i will try it with
the GWT orig. sample DynaTable.
thank you very much
Mat
here is my report: i have tried to debug with the DynaTable in hosted
mode, it seems not to work just like my code. But it works on the
client side. Can you tell me what shall i do?
Thank you
Mat
I have 1.1.10 version and the GWTShell class is not available in
gwt-user.jar but in the gwt-dev-windows.jar (for windows)... has this
changed with the versions and can someone describe exactly what all the
jars are for: the gwt-user.jar, gwt-dev-windows.jar and the
gwt-server.jar. additionally I read here
http://jroller.com/page/masini?entry=deploy_and_debug_google_web that
the gwt-user.jar must be changed to exclude the javax. packages in case
of deployment to external app server. Is this still really necessary?
Some reference with description of the jars will be very helpful
thanks,
ilko