简体   繁体   中英

How to resolve "Access to host class is not allowed or does not exist" in Karate

A bit frustrated that can't make this work, as it is simply documented on this link https://github.com/karatelabs/karate#calling-java

Tried to create from scratch using maven archetype and the standalone jar just to make sure its not about folder structure. Please see below screenshots:

Maven原型 独立罐

Update: It works after removing.java in the parameter value.

instead of * def helper = Java.type('examples.users.Helper.java') changed it to * def helper = Java.type('examples.users.Helper')

But only works when run as cucumber feature from eclipse. Still cant make it work in vscode.

在此处输入图像描述

It works after removing.java in the parameter value.

instead of 
* def helper = Java.type('examples.users.Helper.java') 

changed it to 
* def helper = Java.type('examples.users.Helper')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM