java 伪造dns,如何更改java DNS服务提供商

I'm building a fast web crawler and I need to have multithreaded DNS resolution, so I picked up a multithreaded DNS service provider called dnsjava. Unfortunately, I can't figure out how to replace the default DNS Service Provider.

I went over the README file for dnsjava, but the instructions are not very through.

Replacing the standard Java DNS

functionality:

Beginning with Java 1.4, service

providers can be loaded at runtime.

To load the dnsjava service provider,

build it as explained above and set

the system property:

sun.net.spi.nameservice.provider.1=dns,dnsjava

This instructs the JVM to use the

dnsjava service provide for DNS at the

highest priority.

There are a couple of things that I'm unclear on:

Where do I place the dnsjava.jar?

Where is the system property supposed to be set (is it programmatic or some type of file change)?

I'm running on a Windows 7 machine and I'm not sure what I need to do to find/modify the system properties... help!?

Update:

Got it: System.setProperty("sun.net.spi.nameservice.provider.1","dns,dnsjava");

解决方案

A wild guess.

Put the dnsjava.jar file in the classpath of your application.

Have the system property set before launching the main method in your application.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值