在编写RabbitMq的过程中需要引用amqp-client-4.0.0.jar 包
首先:下载jar包
root@localhost workspace]# wget http://repo1.maven.org/maven2/com/rabbitmq/amqp-client/4.0.0/amqp-client-4.0.0.jar
然后拷贝jar包到jre的扩展目录下:%JRE_HOME%/lib/ext
[root@localhost workspace]# mv amqp-client-4.0.0.jar /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64/jre/lib/ext/
测试代码:test.java
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
public class test
{
public static void main( String[]args )
{
System.out.println("asdfasdfasdfasfd");
}
}
root@localhost workspace]# javac test.java [root@localhost workspace]# java test asdfasdfasdfasfd
原文链接:https://www.f2er.com/centos/379424.html