如何判断是否将jedis添加到classpath中?

时间:2016-10-18 01:37:13

标签: java jar redis classpath jedis

如何知道jar是否已添加到java应用程序AccessRedis.java的类路径中?

我看了很多关于它的帖子但没有帮助。我有一个RHS 6.8服务器,我正在尝试在编译java应用程序时将jedis 2.9.0 jar添加到类路径中。这是应用程序:

import redis.*;

public class AccessRedis {
    public static void main(String[] args){
        System.out.println("Simple redis instance");

    }
}

这是我用来编译java文件的命令:

javac -cp ".:/home/username/jedis-2.9.0.jar" AccessRedis.java

我收到以下错误:

AccessRedis.java:1: error: package redis does not exist
import redis.*;
^
1 error

如何知道jar是否已添加到类路径中?我是否正确地将jar添加到类路径中?

1 个答案:

答案 0 :(得分:1)

没有<!DOCTYPE html> <body> <div class="img"> <a target="_blank" href="https://unsplash.it/200/300/?random"> <img src="https://unsplash.it/200/300/?random" alt="Trolltunga Norway" > </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="https://unsplash.it/g/300/400"> <img src="https://unsplash.it/g/200/300" alt="Forest" > </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="https://unsplash.it/g/400/400"> <img src="https://unsplash.it/g/400/400" alt="Northern Lights" > </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="https://unsplash.it/g/400/400"> <img src="https://unsplash.it/g/400/400" alt="Northern Lights" > </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="https://unsplash.it/g/400/400"> <img src="https://unsplash.it/g/400/400" alt="Northern Lights" > </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="https://unsplash.it/g/400/400"> <img src="https://unsplash.it/g/400/400" alt="Northern Lights" > </a> <div class="desc">Add a description of the image here</div> </div> <div class="img"> <a target="_blank" href="https://unsplash.it/g/400/400"> <img src="https://unsplash.it/g/400/400" alt="Northern Lights" > </a> <div class="desc">Add a description of the image here</div> </div>的课程, 而是redis.*