Mac 中的 Java 1.6 没有 SwingWorker
我在将 Java 文件从 Ubuntu 迁移到 Mac 时遇到问题。 Mac 抱怨我对 SwingWorker 的使用——它找不到 javax.swing.SwingWorker 。
在 Mac 的终端中,执行 java -version
告诉我我的版本是 1.6.0_03-p3。在 Ubuntu 中,我有 1.6.0_20。差别有那么大吗?如何升级 Mac 的 Java 以便可以使用 SwingWorker?
谢谢!
编辑:
我点击了 TofuBeer 回复中的链接。我的 eclipse.ini 现在显示为
-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
-vmargs
-Xms40m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
我已重新启动 Eclipse,但它仍然无法识别 SwingWorker。我的eclipse.ini有什么问题吗?我尝试导航到 -vm 下指示的路径。我注意到在版本中,1.6.0 的文件夹只是一个快捷方式(而不是实际的目录)。这会影响什么吗?
(除非版本中的文件夹 1.6.0 只是一个快捷方式,否则指示的路径确实存在。)
I'm having problems migrating my Java files from Ubuntu to Mac. Mac complains about my use of SwingWorker---it can't find javax.swing.SwingWorker .
In Mac's terminal, doing java -version
tells me I have version 1.6.0_03-p3. In Ubuntu, I have 1.6.0_20. Is it that big a difference? How do I upgrade Mac's Java so I can use SwingWorker?
Thanks!
EDIT:
I followed the link at TofuBeer's reply. My eclipse.ini now reads as
-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
-vmargs
-Xms40m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
I've restarted Eclipse but it still does not recognize SwingWorker. Is there anything wrong with my eclipse.ini? I tried to navigate to the path indicated under -vm. I noticed that in Versions, the folder for 1.6.0 is just a shortcut (not an actual directory). Will that affect anything?
(Barring the fact that the folder 1.6.0 in Versions is just a shortcut, the path indicated does exist.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确实如此!
至少在 v1.6.0_26 上,可能在 1.6.0_03-p3 上不存在,请尝试更新您的 Java 版本,应该像运行软件更新一样简单:
It does!
At least on v1.6.0_26, probably wasn't there on 1.6.0_03-p3 try updating your Java version, should be as simple as running Software update:
您是在命令行还是在 Eclipse 或 Netbeans 等应用程序中构建?我会检查您是否安装了多个 Java 副本,包括可能没有 SwingWorker 的旧 1.5 版本。
Are you building at the command line, or in an application such as Eclipse or Netbeans? I'd check that you don't have multiple copies of Java installed, including an older 1.5 version that may not have SwingWorker.
我不使用 Eclipse,但请查看此处检查它所使用的 JDK。
I don't use Eclipse, but take a look here for checking the JDK it is using.