如何解决“不允许访问主机类或主机类不存在”的问题在空手道中

发布于 2025-01-19 03:14:57 字数 876 浏览 3 评论 0原文

有点沮丧,无法完成这项工作,因为它只是在此链接上记录 https:/ /github.com/karatelabs/karate#calling-java

尝试使用 Maven 原型和独立 jar 从头开始​​创建,只是为了确保它与文件夹结构无关。请参阅下面的屏幕截图:

Maven 原型独立 Jar

更新: 删除参数值中的 .java 后即可工作。

而不是 * def helper = Java.type('examples.users.Helper.java') 将其更改为 * def helper = Java.type('examples.users.Helper')

但仅在从 Eclipse 作为 Cucumber 功能运行时才有效。 仍然无法使其在 vscode 中运行。

输入图片此处描述

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 Archetype
Standalone Jar

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.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤檠 2025-01-26 03:14:58

它在删除参数值中删除.java后起作用。

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

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

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')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文