如何使用 java 类路径配置 Maven-exec 插件

发布于 2024-11-27 06:43:46 字数 346 浏览 5 评论 0原文

我正在尝试运行 maven-exec 插件,并将 jar 文件引用为类路径

<configuration>
  <executable>java</executable>
  <longClasspath>true</longClasspath>
  <commandlineArgs>-classpath jarfile; Sample
  </commandlineArgs>
</configuration>

,但我的类路径设置不正确,因此引发了 classNotFoundException。如何配置这个?

i am trying to run the maven-exec plugin with referring the jar file as classpath like this

<configuration>
  <executable>java</executable>
  <longClasspath>true</longClasspath>
  <commandlineArgs>-classpath jarfile; Sample
  </commandlineArgs>
</configuration>

but my classpath is not set properly thus thrown an classNotFoundException. How to configure this?

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

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

发布评论

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

评论(1

守不住的情 2024-12-04 06:43:46

您的类路径不应以分号结尾。只需 -classpath jarfile Sample,假设“Sample”是您尝试运行的类的名称。为了安全起见,我还会删除该命令行字符串末尾的换行符。

Your classpath shouldn't end with a semicolon. Just -classpath jarfile Sample, assuming that "Sample" is the name of the class you're trying to run. I'd also eliminate the newline at the end of that command line string to be safe.

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