在哪里可以找到在项目中使用的 javax.websocket .jars [英] Where to find javax.websocket .jars for use in project

查看:56
本文介绍了在哪里可以找到在项目中使用的 javax.websocket .jars的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用 Java 库 jPushbullet2.它的依赖项之一是javax.websocket".我已经搜索了 websocket API 所在的站点,但找不到要下载和使用的 jar.这样的事情存在吗?

I've been attempting to use the Java library, jPushbullet2. One of its dependencies is "javax.websocket". I've searched through the site that the websocket API is located and haven't been able to find a jar to download and use. Does such a thing exist?

我也注意到jPushbullet2的作者提到了Tyrus,这是一个参考实现",推测参考javax.websocket.这是我需要的吗?我已经将它与其他依赖项一起添加到我的项目的构建路径中,并尝试运行第一个推送示例:

I also noticed that the author of jPushbullet2 mentioned Tyrus, which is a "reference implementation", presumable in reference to javax.websocket. Is this what I need? I've already added it to my project's build path along with the other dependencies and have tried to run the first push sample:

public class FirstPush {

    public static void main(String[] args) throws PushbulletException {

        PushbulletClient client = new PushbulletClient( "o.F8y8swnMc4MESY5rE1aUw8cFLloFH2uH" );
        String result = client.sendNote(null, "My First Push", "Great library. All my devices can see this!");
        System.out.println( "Result: " + result );

    }

}

然而,不幸的是,这会导致以下错误:

However, this unfortunately results in the following errors:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/websocket/CloseReason$CloseCode
at practice.FirstPush.main(FirstPush.java:10)
Caused by: java.lang.ClassNotFoundException: javax.websocket.CloseReason$CloseCode
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more

这是有道理的,因为我没有来自 javax 的任何 jar,只有来自 Tyrus.

This makes sense, since I don't have any jars from javax, only from Tyrus.

正如您可能知道的那样,我对外部图书馆场景非常陌生.感谢您的帮助!

I'm very new to the external-library scene, as you probably can tell. Thank you for the help!

推荐答案

我必须在我的项目中添加 2 个 jar 文件:javax.websocket-client-api-1.1.jartyrus-standalone-client-1.9.jar 使其工作.一个简单的谷歌搜索就完成了这项工作:

I had to add 2 jar files to my project: javax.websocket-client-api-1.1.jar and tyrus-standalone-client-1.9.jar to make it work. A simple google search did the job:

https://jar-download.com/explore-java-source-code.php?a=javax.websocket-client-api&g=javax.websocket&v=1.1&可下载=1

https://jar-download.com/explore-java-source-code.php?a=tyrus-standalone-client&g=org.glassfish.tyrus.bundles&v=1.9&down​​loadable=1.

这篇关于在哪里可以找到在项目中使用的 javax.websocket .jars的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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