question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when running test on IntelliJ IDEA

See original GitHub issue

Hi,

I have updated Karate Version to last version released (0.5.0) in pom.xml file:

    <properties>
        <karate.version>0.5.0</karate.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-apache</artifactId>
            <version>${karate.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-junit4</artifactId>
            <version>${karate.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

And with this version:

IntelliJ IDEA 2016.3.5 Build #IC-163.13906.18, built on March 6, 2017 JRE: 1.8.0_112-release-408-b6 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

When I launch a specific feature with Cucumber Plugin (https://plugins.jetbrains.com/plugin/7212-cucumber-for-java), I receive this error:

Exception in thread "main" java.lang.NoClassDefFoundError: javafx/collections/ObservableList
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetPublicMethods(Class.java:2902)
	at java.lang.Class.getMethods(Class.java:1615)
	at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:40)
	at cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:86)
	at cucumber.runtime.Runtime.<init>(Runtime.java:92)
	at cucumber.runtime.Runtime.<init>(Runtime.java:70)
	at cucumber.runtime.Runtime.<init>(Runtime.java:66)
	at cucumber.api.cli.Main.run(Main.java:35)
	at cucumber.api.cli.Main.main(Main.java:18)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: javafx.collections.ObservableList
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 16 more

If I launch this with mvn clean test works fine.

Anyone has suffered this bug?

Thanks for all

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Mar 31, 2022

@nikhila294 you are using a very old version of karate which is not supported any more. also please ask these kinds of questions on stack overflow

1reaction
AlberTajuelocommented, Aug 4, 2017

Hi @ptrthomas

Thanks for your response.

I have run it with a Karate-UI and I receive this error:

Error:(12, 12) java: cannot access javafx.application.Application
  class file for javafx.application.Application not found

I have been reading this StackOverFlow thread and I have found that “openjfx” is not installed by default when you install OpenJDK v8. and they recommend two options:

  • Install OracleJDK v8.
  • Install “openjfx” package.

For IntelliJ IDEA users, you have to do this following steps:

  • Select “File” > “Project Structure”.
  • Move to “SDKs” tab and select your “1.8” Java.
  • Click on red minus button and then re-add the JDK
  • Now, you will have JavaFX related files needed and loaded by IntelliJ IDEA.

You have to make sure that you have this jar files in classpath:

  • /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar
  • /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfxswt.jar

So, now it is working fine. It should be recommended in the extensive documentation to recommend to add this javafx library.

Thanks for your time @ptrthomas

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to run JUnit test in IntelliJ - java - Stack Overflow
Open Class in Intellij and press Ctrl+Shift+T · Select "Create New Test" · Now, a new pop up will be opened where you...
Read more >
Error when running tests. – IDEs Support (IntelliJ Platform)
I am getting this error when running either a Robot test or unit test. This is for an existing project. I started getting...
Read more >
Run tests | IntelliJ IDEA Documentation - JetBrains
To run all tests in a folder, select this folder in the Project tool window and press Ctrl+Shift+F10 or select Run Tests in...
Read more >
Right-click on a test class does not show the "run" options
Your project works just fine at my environment - ContextMenuTest is successfully run via context menu action. Please try to execute 'main menu...
Read more >
Build error when unit testing only says 'com/intellij/javaee ...
I am using IntelliJ IDEA 2020.2 (Ultimate Edition) and when I try to run a unit test by clicking on the green arrow...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found