java.lang.UnsatisfiedLinkError: sun.awt.SunToolkit.getAppContext 异常解决办法
来源:互联网 发布:程序员怎么接私活 编辑:程序博客网 时间:2024/05/22 07:43
第一次在做AWT时候遇到上述异常,弄了几天都没效果,偶然的在国外的一个java论坛上看到
Since version 3.3, SWT automatically finds its required platform-specific libraries, which are inside the swt.jar (at the top level of the JAR contents). So all you need is swt.jar in the classpath, and it works.
One way to get an UnsatisifiedLinkError is if you're using a swt.jar for another platform -- they're all named "swt.jar"; for example, if you download the one for Linux, and try to use it on Windows. The project will compile OK since all the API-level code is the same Java for every platform, but it will fail when you run because the native libraries are wrong.
However, since the error in this case happens in AWT, it might be something else, not directly related to SWT. First, make sure you've downloaded the Windows SWT release. When you import it into your workspace, it creates an Eclipse project named org.eclipse.swt, which contains the swt.jar. You then make org.eclipse.swt a required project for your project, and nothing else in the Build Path besides a valid, clean JRE (you can try defining a new one [Window -> Preferences -> Java -> Installed JREs], or just use a different one you might have installed).
You can also test it from the shell/command window. Go to your project directory. The command should be as simple as:
java -cp bin;../org.eclipse.swt/swt.jar HelloWorldSWT
I got your code to run (Vista-32, JDK 6_15), but the window opened really small, and would not close. I don't know anything about the SWT-AWT bridge though, so good luck with that....
照着这样做了效果也没出,还是报异常,
仔细检查了下JDK 和JRE的版本,由于JAVA的自动更新
jdk的版本没变,而JRE版本不同,比如你的安装目录为C:/JAVA
看下你的该目录下是不是多了一个JRE的更新目录,在控制面板里面去把更新的版本删除就好。。。
】OK
- java.lang.UnsatisfiedLinkError: sun.awt.SunToolkit.getAppContext 异常解决办法
- Java.lang.UnsatisfiedLinkError解决办法
- android java.lang.UnsatisfiedLinkError: 异常
- java.lang.UnsatisfiedLinkError异常 (javacv)
- linux下jfreechart生成图片异常(java.lang.NoClassDefFoundError sun.awt.X11GraphicsEnvironment)
- linux下jfreechart生成图片异常(java.lang.NoClassDefFoundError sun.awt.X11GraphicsEnvironment)
- Linux下Tomcat中POI导出异常:java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment
- java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit异常解决
- tomcat java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit异常解决
- Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError:
- JNI异常:java.lang.UnsatisfiedLinkError-已解决
- JNI调用 java.lang.UnsatisfiedLinkError 异常
- 关于Java.lang.UnsatisfiedLinkError的错误解决办法
- java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader解决办法
- JNI调用native方法出现 java.lang.UnsatisfiedLinkError: XXXclass.XXXmethod()异常的解决办法
- JNI调用native方法出现 java.lang.UnsatisfiedLinkError: XXXclass.XXXmethod()异常的解决办法
- java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
- "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no freetype in java.library.path
- 我眼里的需求版本控制
- 需求迭代与项目风险控制
- windows 应用程序编程基础知识
- Winform,C#,listView判断鼠标点击是行还是listView的空白区
- TLS (Thread local storage)
- java.lang.UnsatisfiedLinkError: sun.awt.SunToolkit.getAppContext 异常解决办法
- 沉默
- pku 1077 eight(据说有人用8中搜索算法做了这道题目)
- 利用 IBM Rational Suite AnalystStudio 进行迭代需求管理
- JAVA的容器---List,Map,Set
- 项目管理中的(用户)需求变更控制分析
- 报表演变历史-多层分组报表-小计合计
- Visual C++编程讲义一: Windows消息队列
- 报表演变历史-分组报表-小计合计-其他2