Java help

ebymohan's Avatar, Join Date: Sep 2010
Newbie Member
i hav been programing java for a couple of months and now i need som help

below applet program yeilds 2 different results when executed in net beans and when embeded in a html page
when executed in net beans it shows the correct result (the correct IP addres of the system)
when embeded in html it shows a different result(som other address and not the actual IP address)
can u tel me why
i want to get the correct IP adress from the HTML(to continue with my work)

this is the code

import java.awt.*;
import javax.swing.*;

public class NewEmpty extends JApplet {
    public void start() {
    try {
    InetAddress thisIp =InetAddress.getLocalHost();
    JOptionPane.showMessageDialog(null, "1The IP ADDRESS is " + thisIp, "IP ADDRESS",JOptionPane.PLAIN_MESSAGE );
    JOptionPane.showMessageDialog(null, "2The IP ADDRESS is " + thisIp.getHostAddress(), "IP ADDRESS",JOptionPane.PLAIN_MESSAGE );
    catch(Exception e) {
    public void paint(Graphics g) {
        g.fillRect(20, 20, 50, 30);
        g.fillRect(50, 30, 50, 30);
        g.drawString( " IP ADDRESS GETTER" , 70 , 30 );

Last edited by shabbir; 22Sep2010 at 23:13.. Reason: Code blocks
ebymohan's Avatar, Join Date: Sep 2010
Newbie Member
plz som body help