Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Java help (http://www.go4expert.com/forums/java-help-t23385/)

ebymohan 22Sep2010 11:02

Java help
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 java.net.*;
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 );

ebymohan 24Sep2010 12:30

Re: Java help
plz som body help

All times are GMT +5.5. The time now is 19:29.