1.导入 redis jar 包
2.安装redis
3.打开redis 服务器:打开一个 cmd 窗口 使用cd命令切换目录到 C:\redis 运行 redis-server.exe redis.windows.conf
4.myclipse 测试
“`
package com.redis.redisDemo;
import redis.clients.jedis.Jedis;
public class RedisDemo {
public static void main(String[] args) {
//Connecting to Redis server on localhost
Jedis jedis = new Jedis(“localhost”);
System.out.println(“Connection to server sucessfully”);
//check whether server is running or not
System.out.println(“Server is running: “+jedis.ping());
}
}
结果
“`