eclipse 为什么在调试模式下启动 GWT 时,我的断点没有中断
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/960670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why when starting GWT in debug mode, my break points don't break
提问by Cosmo
I am using Eclipse 3.4.2 with the latest GWT. The IDE doesn't even switch to Debug Perspective automatically.
我正在使用带有最新 GWT 的 Eclipse 3.4.2。IDE 甚至不会自动切换到 Debug Perspective。
回答by Cosmo
I have found a different thread in groups discussing my problem.
我在讨论我的问题的小组中发现了一个不同的线程。
Basically, JDK 1.6.0_14 will not work with GWT in eclipse debug mode. Switching a different JDK will work.
基本上,JDK 1.6.0_14 在 Eclipse 调试模式下不能与 GWT 一起使用。切换不同的 JDK 将起作用。
回答by VonC
Do you launch your GWT application in hosted mode?
您是否以托管模式启动 GWT 应用程序?
You will spend most of your development time running your application in hosted mode, which means that you are interacting with your GWT application without it having been translated into JavaScript.
Anytime you edit, run, and debug applications from a Java integrated development environment (IDE), you are working in hosted mode.
When an application is running in hosted mode, the Java Virtual Machine (JVM) is actually executing the application code as compiled Java bytecode, using GWT plumbing to automate an embedded browser window.
This means that the debugging facilities of your IDE are available to debug both your client-side GWT code and any server-side Java code as well.
您将花费大部分开发时间在托管模式下运行您的应用程序,这意味着您正在与您的 GWT 应用程序交互,而无需将其转换为 JavaScript。
无论何时从 Java 集成开发环境 (IDE) 编辑、运行和调试应用程序,您都在托管模式下工作。
当应用程序在托管模式下运行时,Java 虚拟机 (JVM) 实际上将应用程序代码作为编译的 Java 字节码执行,使用 GWT 管道来自动化嵌入式浏览器窗口。
这意味着 IDE 的调试工具可用于调试客户端 GWT 代码和任何服务器端 Java 代码。
Tip: If you are using Eclipse, you can also create a launch configuration file when creating a new project with
applicationCreator
by using the -eclipse flag.If you didn't use
applicationCreator
to create an application-specific hosted mode shell script, you can manually run the main class incom.google.gwt.dev.GWTShell
found (depending on your OS) ingwt-dev-windows.jar
,gwt-dev-linux.jar
, orgwt-dev-mac.jar
.Important: If you are not using the generated
<module>-shell
script, be aware that in hosted mode, the GWT development shell looks for modules (and therefore client-side source) using the JVM's classpath. Make sure to add your source directories first in your classpath.
提示:如果您使用 Eclipse,您还可以在
applicationCreator
使用 -eclipse 标志创建新项目时创建启动配置文件。如果您没有使用
applicationCreator
来创建一个应用程序特定的托管模式的shell脚本,你可以手动运行在主类com.google.gwt.dev.GWTShell
;实测值(视操作系统而定)的gwt-dev-windows.jar
,gwt-dev-linux.jar
或gwt-dev-mac.jar
。重要提示:如果您没有使用生成的
<module>-shell
脚本,请注意在托管模式下,GWT 开发 shell 使用 JVM 的类路径查找模块(以及客户端源)。确保首先在类路径中添加源目录。
See also Debug in Hosted Mode
另请参阅在托管模式下调试
alt text http://google-web-toolkit-doc-1-5.googlecode.com/svn/wiki/StockWatcherDebug1.png
替代文字 http://google-web-toolkit-doc-1-5.googlecode.com/svn/wiki/StockWatcherDebug1.png
回答by Don Kirkby
These days, it seems that GWT classic dev mode is no longer supported, or at least not recommended. It's been replaced by GWT super dev mode, which runs your code in Javascript, not on the JVM. This means that you debug in your browser, instead of in Eclipse. For example, I visited my site in Chrome, opened the developer tools, switched to the sources tab, and then looked under the sourcemaps folder to find all my Java classes. I can put breakpoints there, and the browser will stop when the Javascript equivalent is running. I can inspect the Javascript variables that roughly match my Java variables.
这些天,似乎不再支持 GWT 经典开发模式,或者至少不推荐。它已被 GWT 超级开发模式取代,该模式在 Javascript 中运行您的代码,而不是在 JVM 上。这意味着您在浏览器中进行调试,而不是在 Eclipse 中。例如,我在 Chrome 中访问了我的站点,打开了开发人员工具,切换到了源选项卡,然后在 sourcemaps 文件夹下查找我所有的 Java 类。我可以在那里放置断点,当 Javascript 等效项运行时,浏览器将停止。我可以检查与我的 Java 变量大致匹配的 Javascript 变量。
If you really prefer debugging in Eclipse, you can use the Super Dev Mode Debugger Eclipse plugin, but it's doing the same thing as the Chrome debugger. When I tried it out, I had to watch the video to get it working.
如果您真的更喜欢在 Eclipse 中进行调试,您可以使用Super Dev Mode Debugger Eclipse 插件,但它的功能与 Chrome 调试器相同。当我试用它时,我必须观看视频才能使其正常工作。
回答by Brian Sternari
I had the same problem. In my case the problem was that I was using JREinstead of JDK. Setting JDKinstead of JRE, solved my problem. I recommend reviewing the build configuration to see which one is being used.
我有同样的问题。就我而言,问题是我使用的是JRE而不是JDK。设置JDK而不是JRE,解决了我的问题。我建议查看构建配置以查看正在使用的配置。
回答by Farinha
I'm running 1.6.0_13 and still the debug doesn't work. It just doesn't hit the breakpoints. And more, the page shows up blank in hosted mode (except for the static content in the HTML file), but everything displays and works correctly when running on the browser.
我正在运行 1.6.0_13,但调试仍然不起作用。它只是没有达到断点。此外,该页面在托管模式下显示为空白(HTML 文件中的静态内容除外),但在浏览器上运行时,一切都显示并正常工作。
java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
java -version
java 版本“1.6.0_13”
Java(TM) SE 运行时环境(构建 1.6.0_13-b03)
回答by Farinha
Also confirming that the debugger does not work with 1.6.0_14. A downgrade to 1.6.0_13 solved my issue. Farinha, might you still have your java_home (or something similar) pointing to an install of 1.6.0_14 even though you have installed 1.6.0_13?
还确认调试器不适用于 1.6.0_14。降级到 1.6.0_13 解决了我的问题。Farinha,即使您已经安装了 1.6.0_13,您的 java_home(或类似的东西)是否仍然指向 1.6.0_14 的安装?
回答by Cyril
Upgraded to jdk1.6.0_17 - Works fine
升级到 jdk1.6.0_17 - 工作正常
回答by Drejc
Changing the JDK didn't help in my case, but I have finally found out what's wrong.
更改 JDK 对我没有帮助,但我终于发现了问题所在。
When moving from GWT 1.7 to 2.0 the old GWT classes will stay on the war ouput. They must be manually deleted in order for 2.0 to kick in.
当从 GWT 1.7 迁移到 2.0 时,旧的 GWT 类将保留在War输出中。必须手动删除它们才能启动 2.0。
回答by Drejc
I want to confirm that Basically, JDK 1.6.0_14 will not work with GWT in eclipse debug mode. Switching a different JDK will work.
我想确认基本上,JDK 1.6.0_14 在 Eclipse 调试模式下不能与 GWT 一起使用。切换不同的 JDK 将起作用。
I installed JDK 1.6.0_13 and the eclipse debug perspective kicked in. Using eclipse 3.3.2
我安装了 JDK 1.6.0_13 并启动了 Eclipse 调试透视图。使用 Eclipse 3.3.2
Thanks for the tip!
谢谢你的提示!
回答by Kasper-34
I was also following the StockWatcherguide on the GWTwebsite and then got to the Debuggingpart of the tutorial and I could notget my breakpoints to trigger until I stumbled upon the SDBGplugin. I installed the plugin and followed the video and it worked!
我当时也是继的StockWatcher上引导GWT网站,然后就到了调试教程的一部分,我不会让我的断点触发,直到我偶然发现了SDBG插件。我安装了插件并按照视频进行操作,并且成功了!
My environment:
我的环境:
- Eclipse Neon.1a Release (4.6.1)
- JDK 1.7.0_80
- GWT SDK 2.7.0
- Eclipse Neon.1a 版本 (4.6.1)
- JDK 1.7.0_80
- GWT SDK 2.7.0
Additional Notes:
补充说明:
Make sure to make a DebugConfiguration and use com.google.gwt.dev.DevMode
as your Main class.
确保进行调试配置并com.google.gwt.dev.DevMode
用作您的主类。