1

I am trying to call a Java class which has two methods in it. But the execution fails in the below line.

 `* def javademo = Java.type('feature.AuthCode')

Error:

* def javademo = Java.type('feature.AuthCode')
js failed:
>>>>
01: Java.type('feature.AuthCode')
<<<<
org.graalvm.polyglot.PolyglotException: TypeError: Access to host class feature.AuthCode is not allowed       or does not exist.
- <js>.:program(Unnamed:1)`

Please help with the query. Some blogs show to change the Karate Jar Command line argument to target/test-classes. But it doesn't work in my case. Is it something related to Java version? I am using Java 17

reshma
  • 11
  • 1
  • this depends on whether the class exists, your classpath is set up correctly, if the class and methods are public etc. try looking at other answers: https://stackoverflow.com/search?q=%5Bkarate%5D+%22host+class%22 - if you really need more help, follow this process please: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Apr 17 '23 at 12:12

0 Answers0