cancel
Showing results for 
Search instead for 
Did you mean: 

How to Access the Systems ipaddress in a java program

Former Member
0 Kudos

Hi

In a network The ip addresses of every system is changing.So that i want to know the ipaddresses of the system dynamically.

I want a client program to do that.

And also i want to kno how to create a .exe file for java

class file

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

In order to find the IP address of a system dynamically through a java programme Here is code...

import java.net.*;

public class check{

public static void main(String args[])

{

try

{ InetAddress addr = InetAddress.getLocalHost();

String ipaddress_as_text =addr.getHostAddress();

System.out.println(ipaddress_as_text);

}

catch(Exception ex){}

}}

For the 2 question ie to convert a .class file to a

.exe file there are some tools available...

I think the following link will be useful to you.

http://duckware.com/jexepack/index.html

Thank you....

Former Member
0 Kudos

Hi,

To get the ip address dynamically use

InetAddress.getLocalHost()

This returns an InetAddress instance. Refer this link http://java.sun.com/j2se/1.4.2/docs/api/java/net/InetAddress.html#getLocalHost()

If you are using Netweaver Developer Studio, then saving *.java file, will create corresponding *.class file in your workspace.

Else, in command prompt type in

javac <filename>.java

This command will create a <filename>.class file.

Regards,

Uma

Message was edited by: Uma Maheswari

Former Member
0 Kudos

hi soma,

The interface com.sap.engine.lib.security.http.HttpCallback can be used to get the client IP... for more info check this link...

http://help.sap.com/saphelp_nw2004s/helpdata/en/b2/acc4881f6bc54c8b0c9b97dfd22d54/frameset.htm

Regs,

jaga