Share this page 

Get the client IP address (deprecated)Tag(s): DEPRECATED

With modern java plugin installation, only "" is displayed.

The only reliable way is to get this information from the server-side.

import java.applet.*;

public class GetClientIP extends Applet {
  public void init() {
    try {
     InetAddress thisIp =
    catch(Exception e) {

<APPLET CODE="GetClientIP.class"  
      HEIGHT=10 WIDTH=10>
 Check JAVA console for output
Try it here

NOTE: Netscape returns the IP address with the default security settings so it's not problem. With IE5, you must go to the security TAB, Internet, Java Custom, Edit and select "Allow access to all IP address".

Using a Servlet, this can be done with :

public void service(HttpServletRequest req, HttpServletResponse res) 
 throws IOException {
   String IP = req.getRemoteAddr();