1

I am getting the above error message (java.lang.UnsatisfiedLinkError) when running UISpec test case in Eclipse as well as IntelliJ.

I have sun/oracle JDK 1.7 installed.

The full report of the error is

> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> sun.awt.motif.MToolkit.init(Ljava/lang/String;)V    at
> sun.awt.motif.MToolkit.init(Native Method)  at
> sun.awt.motif.MToolkit.<init>(MToolkit.java:146)    at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>     at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>     at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
>     at java.lang.Class.newInstance0(Class.java:372)     at
> java.lang.Class.newInstance(Class.java:325)     at
> org.uispec4j.interception.toolkit.UISpecToolkit.buildUnderlyingToolkit(UISpecToolkit.java:128)
>     at
> org.uispec4j.interception.toolkit.UISpecToolkit.setUp(UISpecToolkit.java:39)
>     at
> org.uispec4j.interception.toolkit.UISpecToolkit.<init>(UISpecToolkit.java:24)
>     at org.uispec4j.UISpec4J.initToolkit(UISpec4J.java:39)  at
> org.uispec4j.UISpec4J.init(UISpec4J.java:31)    at
> org.uispec4j.UISpecTestCase.<clinit>(UISpecTestCase.java:31)    at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>     at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>     at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
>     at junit.framework.TestSuite.createTest(TestSuite.java:131)     at
> junit.framework.TestSuite.addTestMethod(TestSuite.java:114)     at
> junit.framework.TestSuite.<init>(TestSuite.java:75)     at
> com.intellij.junit3.TestRunnerUtil.createClassOrMethodSuite(TestRunnerUtil.java:140)
>     at
> com.intellij.junit3.TestRunnerUtil.getTestSuite(TestRunnerUtil.java:79)
>     at
> com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:50)
>     at
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
>     at
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:601)     at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> 
> Process finished with exit code 1

If anyone had experienced the same issue please help me.

Athiruban
  • 616
  • 1
  • 5
  • 17

2 Answers2

2

Looks like a known Java Bug: 6996291.

The issue seems to be caused by UISpec explicitly loading sun.awt.motif.MToolkit on Linux, while this toolkit is no longer available in JDK 1.7. See if there is a way to disable it in the UISpec configuration or report the issue to the developers.

As a workaround you can use Oracle JDK 1.6.0.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • You are really correct. The problem was due to the non-availability of the toolkit in JDK 1.7. But when I run > javap sun.awt.Motif.MToolkit it showed the class declaration. So I thought the class is available in JDK1.7. Also, I reported the problem to UISpec developer team. Once again, Thanks a lot. – Athiruban Dec 30 '11 at 12:43
1

I had exactly the same problem, but using openjdk (under Linux Mint). Removing openjdk and installing sun-java6-jdk instead (with the Linux-Software-Manager) solved the problem.

Niels
  • 11
  • 1