Question: Is it possible to add a record to the dns cache from java? Or will I have to use the JNI?

Answer: 
Java DNS caching is implemented in a manner that should be mostly transparent to your code. You can read the javadoc of [InetAddress](http://java.sun.com/javase/6/docs/api/java/net/InetAddress.html) to learn more about how you can configure the cache. But since it serves as a JVM-wide transparent proxy, the best way you have to add a cache entry would simply be to actually issue a request directed to the domain you want to cache the info for.

Out of curiosity, what's your use case?
Why don't you just configure java for using the proxy? 

```
java -DproxySet=true -DproxyHost=proxy -DproxyPort=8080 MyApp

```

or 

```
System.setProperty("proxyPort","8080");
System.setProperty("proxyHost","proxy");

```

will do it.