获取java.lang.ClassNotFoundException,即使我已经使用-cp指定了正确的jar [英] Getting a java.lang.ClassNotFoundException even though i've specified the correct jar with -cp

查看:151
本文介绍了获取java.lang.ClassNotFoundException,即使我已经使用-cp指定了正确的jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java.lang.ClassNotFoundException:com.hazelcast.core.Hazelcast

java.lang.ClassNotFoundException: com.hazelcast.core.Hazelcast

这一点很奇怪,因为我已经添加了hazelcast-1.8.5.jar当我运行java时的类路径:

This bit is strange though, because i've added hazelcast-1.8.5.jar to the classpath when i'm running java:

java -cp hazelcast-1.8.5.jar -jar myapp.jar

所以我无法理解为什么我得到了ClassNotFoundException,当榛树罐子真正存在时,在命令行中指定。请问有什么想法吗?

So i cannot understand why i'm getting the ClassNotFoundException, when the hazelcast jar is well and truly present, and specified in the command line. Any ideas please?

顺便说一句,hazelcast很可爱!

By the way, hazelcast is pretty fricking sweet!

推荐答案

来自 -jar选项docs

使用此选项时,JAR文件是所有用户类的源,其他用户类路径设置将被忽略。

这篇关于获取java.lang.ClassNotFoundException,即使我已经使用-cp指定了正确的jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆