How get IPv4 instead of IPv6 (class NetworkInterface)

Hello! I've written java code:
nets = NetworkInterface.getNetworkInterfaces();
NetworkInterface selInterface = Collections.list(nets).get(curIndex);
ips = selInterface.getInetAddresses();
InetAddress addr = Collections.list(ips).get(0);
String str = addr.getHostAddress();
And I obtain IPv6, for example: fe80::20c:29ff:fe2d:a225. How can I get IPv4 or transform IPv6?
p.s. this problem is observed only in Linux, on windows machine program works good.

Note : IPV4 address and IPV6 address are unrelated (i.e. no conversion from one to another)Note: this is not correct. Some IPv6 address formats are explicitly provided to act as representations of IPv4 addresses.

Similar Messages

  • How get controls name from a class private data?

    How can i get the names of the controls inside a class private data?
    I am using Actor Framework and trying to create a method tha will be executed when launch the actor. This method need a list o all the control names inside the class data to search for the initial value inside a configuration file (config.ini), the key on the configuration file will be the name of the control.
    Thanks.
    Solved!
    Go to Solution.

    You are already making the overriding method just because you have to write to the Bundle By Name.  And then how are you going to handle all of the data types the keys could be.  You are making things more difficult than it should be for really very little benefit.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • I just got my mac book pro and i was  wondering if i could get ichat instead of messages and if so, how can i get it?

    i just got my mac book pro and i was  wondering if i could get ichat instead of messages and if so, how can i get it?

    Welcome to the Apple Support Communities
    Messages can't be uninstalled to use iChat. Messages is the same as iChat but with iMessage support. See > http://support.apple.com/kb/HT5395

  • I currently have imessage on my mac and i want ichat how could i get ichat instead of having messages?

    i currently have imessage on my mac and i want ichat how could i get ichat instead of having messages?

    Take this post to the appropriate version of OSX you are using. You didn't say which.
    This is the Pages forum.
    Peter

  • How to programmatically get the source for a class provided the class name?

    Hello,
    As a quick background, I am providing some tools to potential users of an in-house framework. One is the ability to generate quick prototypes from our existing demo applications. Assume a user downloads our jars and uses them in their project (we are using Eclipse, but that detail should not greatly affect my question). Included in the jars is a demos package that contains ready-to-run classes that serve to exhibit certain functionality. Since many users may just need quick extensions of these demos, I am trying to provide a way for them to be able to create a new project that starts with a copy of the demo class.
    So, the user is provided a list of the existing demos (each one uses a single class). When the user makes their selection, with the knowledge of our framework, I can translate that into what demo class they need (returned as a string of format package.subpack1.subpackn.DemoClassName). What I now want to do is to use that complete class name to get the source (look up the file) for the corresponding class, and copy it into to a new file in their project (the copying into the project can be done easily in Eclipse, so what I need help with is the bolded part). Is there a simple way to get the source given a class path for a class as described above? You may assume the source files are included in the jars for the framework.
    Thanks in advance.

    If there's a file named "package.subpack1.subpackn.DemoClassName.java" in a "demos" directory in the jar, then yes. You'd just use
    InputStream code = getResourceAsStream("/demos.package.subpack1.subpackn.DemoClassName.java");Or if those dots in the name actually separate directory names, i.e. you have a "package" directory under "demos" and a "subpack1" director under that and so on, then:
    InputStream code = getResourceAsStream("/demos/package/subpack1/subpackn/DemoClassName.java");

  • How can I get a dynamic list of Classes Loaded

    I assume this may need to use some sort of reflection. Does
    anyone have code or ideas where I can:
    a) I can get a list of all Classes loaded and their
    properties. This would probably be all instances of Class
    b) A list of all
    global instance variables. (This may not even be possible. I
    know it can be done in other languages)
    I assume this may need to use some sort of reflection.
    Thank you

    Adobe Newsbot hopes that the following resources helps you.
    NewsBot is experimental and any feedback (reply to this post) on
    its utility will be appreciated:
    mx.controls.List (Flex 3):
    If the data is incorrect, you can call the preventDefault()
    method to stop Flex from passing the new data back to the list
    control and from closing the
    Link:
    http://livedocs.adobe.com/flex/3/langref/mx/controls/List.html
    Displaying icons in a Flex List control at Flex Examples:
    http://blog.flexexamples.com/2007/08/17/displaying-icons-in-a-flex-list-control/
    --> <mx:Application xmlns:mx=&quot;
    http://www.adobe.com/2006/mxml&quot;
    Link:
    http://blog.flexexamples.com/2007/08/17/displaying-icons-in-a-flex-list-control/
    Populate the list -- Flex 2.01:
    You populate a list-based form control with the
    <mx:dataProvider> child tag. The <mx:dataProvider> tag
    lets you specify list items in several ways.
    Link:
    http://livedocs.adobe.com/flex/201/html/tutorial_controls_019_4.html
    Smooth Scroll for Horizontal List - Flex India Community |
    Google:
    I have created image gallery with Horizontal List[Flex 2.0].
    Just as below ref site. My Problem is i need a smooth scroll for
    Horizontal List. where images
    Link:
    http://groups.google.com/group/flex_india/browse_thread/thread/a12441143b98d32c?hide_quote s=no
    Creating a List control -- Flex 2.01:
    The following example code adds a handler for a change event
    to the List control. Flex broadcasts a mx.ListEvent.CHANGE event
    when the value of the control
    Link:
    http://livedocs.adobe.com/flex/201/html/dpcontrols_062_03.html
    Disclaimer: This response is generated automatically by the
    Adobe NewsBot based on Adobe
    Community
    Engine.

  • How to get the name of a class invoking

    Can a method get the name of the class invoking it?
    As:
    public void myMethod(){
       System.out.println("the name of the class invoking this method is: " + XXXXX);
    }Edited by: Maria1990 on Aug 17, 2010 8:46 AM

    Maria1990 wrote:
    .getStackTrace() gives me an array with the all details.Or, if you only care about the class, ask a SecurityManager.
    public final class ClassUtils {
        public static final Class[] getClassContext() {
            return new SecurityManager() {
                protected Class[] getClassContext(){return super.getClassContext();}
            }.getClassContext();
        private ClassUtils() {};
        public static final Class getCallingClass() { return getClassContext()[2];}
    }

  • How to clear a private static class attribute once it's been created?

    <pre>I'm working with an instance of a complex Class object that has been created using the function module <br>HRXSS_CAT_APPLICATION_INIT. The Class object that I am trying to work with is<br> CL_XSS_CAT_BUSINESS_LAYER and in particular its Static Private component attribute PROFILE.<br>
    The issue that I am having is that the first call of this function module creates and populates the Static Private component attribute, <br>PROFILE, for the instance of this Class and I do not know how to initialize it once it's been created. The PROFILE attribute is an <br>object reference to an instance of Class CL_XSS_CAT_PROFILE. <br>
    I want to reset/intialize this Static Private component. I can then call a Class Method with<br> different parameters so that it repopulates PROFILE with different attributes. <br>There is no Public method to do this in CL_XSS_CAT_BUSINESS_LAYER and even the Private method<br> INIT_PROFILE, the logic first checks to see if the PROFILE component is initial before creating a new PROFILE<br> object instance. All the Attributes of the CL_XSS_CAT_PROFILE object are Static and Private.
    <br>
    I would appreciate any insight anyone might have in how to reset/initialize this Class component attribute.<br><br>
    Thanks much,<br>
    <br>
    Graham<br>
    Sample code snippet is as follows:
    <br><br>
    DATA: lr_cats_application_rfc TYPE REF TO IF_XSS_CAT_APPLICATION_RFC,
    lr_core TYPE REF TO IF_XSS_PT_APPLICATION_CORE,
    lr_core TYPE REF TO CL_XSS_CAT_1_APPLICATION_CORE,
    lr_instance TYPE REF TO CL_XSS_CAT_APPLICATION,
    lr_business_layer TYPE REF TO CL_XSS_CAT_BUSINESS_LAYER,
    lr_profile TYPE REF TO CL_XSS_CAT_PROFILE,
    lr_profile_temp TYPE REF TO cl_xss_cat_profile.
    DATA: l_employee TYPE pernr_d.
    DATA: l_employee_tab TYPE rhxss_cat_employee_t.
    CASE im_command.
    WHEN 'DATESELECTION_PRVPERIOD'.
    *-> navigate to object component reference for CL_XSS_CAT_PROFILE instance
    lr_cats_application_rfc = im_ref_to_parameter_cache->REF_TO_APPLICATION.
    *-> navigate to object component reference for CL_XSS_CAT_1_APPLICATION_CORE
    lr_core ?= lr_cats_application_rfc->get_core( ).
    *-> navigate to object component reference for CL_XSS_CAT_BUSINESS_LAYER
    lr_business_layer = lr_core->business_layer.
    *-> navigate to object component reference for CL_XSS_CAT_PROFILE
    lr_profile = lr_business_layer->get_profile( ).
    l_employee = im_ref_to_parameter_cache->pernr.
    append l_employee to l_employee_tab.
    <br><br>
    *THIS IS WHERE I AM HAVING ISSUES...I WOULD LIKE TO CLEAR/INITIALIZE THE STATIC PRIVATE COMPONENT<br> LR_BUSINESS_LAYER->PROFILE BEFORE CALLING THE METHOD INITIALIZE_FOR_TIME_RECORDING<br>
    <br>
    <br><br>*THE FOLLOWING LINE FAILS ON A SYNTAX CHECK WITH 'FIELD "PROFILE" IS UNKNOWN. IT IS NEITHER IN <br>ONE OF THE *SPECIFIED TABLES NOR DEFINED BY A "DATA" STATEMENT
    <br>
    clear: lr_business_layer->profile.
    CALL METHOD lr_business_layer->initialize_for_time_recording
    EXPORTING
    im_employee_tab = l_employee_tab
    im_profile_id = 'MODAPPR1'
    im_startdate = sy-datum
    EXCEPTIONS
    pernr_not_enqueued = 1
    no_pernr_for_user_found = 2
    profile_not_found = 3.</pre>
    Edited by: Matt on Aug 1, 2009 12:44 PM

    OK...I apologize but I did not dig deep enough to see that the Enhancement Framework allows for the addition of Methods to Classes/Interfaces. Most of this ABAP OO stuff is still quite new to me so I'm struggling with syntax and what is and isn't possible based on how everything is declared. I guess now that I know I can do this I am having some problems understanding how singleton Class objects work and how to 'reset' them.
    The Class instance based on CL_XSS_CAT_BUSINESS_LAYER has a Static Private attribute PROFILE that is an object reference to the singleton Class instance CL_XSS_CAT_PROFILE.
    The singleton Class instance of CL_XSS_CAT_PROFILE has all of its attributes set to Static Private. If you look at this Class in SE80 you see that one of its attributes is also called PROFILE and is an object reference variable to itself.
    So the issue I am having is how to go about 'initializing' this singleton object so that I can 'recreate' this singleton object using a copy of the existing S
    I used the enhancement framework to create a copy of the CL_XSS_CAT_BUSINESS_PROFILE Instance Private Method INIT_PROFILE , called in INIT_PROFILE2, but I am not sure how to 'clear/reset' the instance of the CL_XSS_CAT_PROFILE object.
    Since PROFILE is an attribute of the CL_XSS_BUSINESS_LAYER object, I thought that a simple CLEAR PROFILE would reset the object but this is not the case. Within this method the FREE clears the value of the reference variable PROFILE but as soon as you step into the method me->init_profile, the value of PROFILE goes back to what it was. I need for all of the CL_XSS_CAT_PROFILE instance attributes to be reset or initialized so I can fill them again. I think I'm getting confused on the scope of things...should I be enhancing the CL_XSS_CAT_PROFILE Class with 'setter' methods so I can initialize all of the Static Private attributes that way instead of trying to clear all the attributes at a higher call level?
    Any assistance with helping me with my thought process or approach to this would be much appreciated.
    METHOD INIT_PROFILE2.
    FREE PROFILE.  >>> is reset but it does not carry through to next method call and does not clear all the attributes of the object referenced in PROFILE
    CALL METHOD me->init_profile
    EXPORTING
    IM_PROFILE_ID = im_profile_id
    etc...

  • How use XML-Parser in Web Dypro (how get filename)

    Hi everybody,
    i want to use the saxparser to read a xml-file via a Fileupload-UI element. In Web Dynpro it is not possible to get the path of a file which was on a client through the Fileupload-UI. So how can i use a xml-parser when i have to give it the file name?
    Is it possible to use the "resource" of the Fileupload-UI instead ot the filename? How can i call the parser?
                        SAXParser saxParser= null;
         try{                   
              SAXParserFactory factory = SAXParserFactory.newInstance();               
              saxParser = factory.newSAXParser();               
              saxParser.parse( new File(??????), new  Gaeb());
         }catch (Exception ex){
              ex.printStackTrace();
    regards,
    Sid

    Hi Siarhei,
    i bind the resource property to my context of type IWDResource, the xml-file is now uploaded to KM-Content : /documents/GSW/Upload_UT_Sample_A.xml.
    I create with resource.getURL() the path of the xml-file and give it to my xml-parser class, but i cannot get any value
    from my parser (value returns "null"). Now i don't know if i have a mistake in creating the path of my file or a mistake in my parser??
    Could you please have a look to my  source code:
    I try to get the path with:
           /* Get Path of "/documents/GSW/XML/Upload_UT_Sample_A.xml" */
           String urlToFile = resource.getUrl(WDFileDownloadBehaviour.AUTO.ordinal());                  
          /* Call the Parser Class with path*/
          MyXMLParser myParser= new MyXMLParser ( urlToFile );
          /* Get one value from xml-class*/
          wdComponentAPI.getMessageManager().reportSuccess("Value: " + myParser.getValue());  <-- returns "null"     
    My XML-Class:
    public class MyXMLParser extends DefaultHandler {
         private String path = null;
         private String fName = null;
         public  String lValue;     
         private boolean lSupplier = false;
         private boolean lQuoteNumber = false;     
         public Gaeb(){ }
         public Gaeb(String path){
              SAXParserFactory factory = null;                         
              SAXParser saxParser = null;
              try {
                   factory = SAXParserFactory.newInstance();                         
                   saxParser = factory.newSAXParser();               
                   saxParser.parse( path , new MyXMLParser () );     <-- i try also new File(path) instead of path.          
              }     catch (Exception ex){               
                   ex.printStackTrace();
         public void startElement(String uri, String localName,
              String qName, Attributes attributes)
              throws SAXException {     
              lSupplier = true;        
         public void characters(char[] ch, int start, int length)
              throws SAXException {
              if (lSupplier){
                   this.lValue = new String (ch,start,length);
         public String getValue(){
              return this.lValue;
    regards,
    Sid
    Edited by: Sid on Dec 2, 2009 2:47 PM

  • How is the java.lang.StringBuffer class different from the java.lang.String

    How is the java.lang.StringBuffer class different from the java.lang.String class?....

    Read the API.
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
    "Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings."
    Although when possible you should use StringBuilder instead of StringBuffer.
    Always read the API at the very least before asking questions in the forums. Ideally you should do some google searching and poke around for an answer too. Otherwise you will get people barking at you.
    Drake

  • IPv4 LAN over IPv6 WAN

    With IPv6 I am most concerned today with receiving an IPv6 address from my ISP for my Spoke networks.  I don't have plans to convert my Spoke LANs  or Internal application servers to IPV6 anytime soon.  Reviewing all the books and technical documentation out there, I don't see discussion about how to get my IPv4 traffic tunneled through the Internet via an IPv6 carrier, a 4to6 tunnel.  Currently I'm running DMVPN which appears to support IPv6 tunnels, Native and 6to4.  Can anyone provide direction or expertise on how to get IPv4 traffic between Enterprise locations with ISPs move to IPv6 addressing?
    Thanks..

    Ryan,
    If this is a question of connecting LAN in different branches.
    The decently scalable option is GRE (with DMVPN being the neatest).
    On top ASA supports IPv4 in IPv6 IPsec (to other ASAs at this point).
    You might have a bit more challanges if you want to provide access to non-intrernal resources, Internet, partner sites without IPv4 on WANs.
    M.

  • How to convert the javasource file(*.class) to execute file(*.exe)?

    How to convert the javasource file(*.class) to execute file(*.exe)?
    thank you!

    Although i have seen a few programs (that are platform specific) that will embed a small jvm into an exe with your class file, it is generally excepted that you cannot create an executable file using java. The JAR executable file is probably the closest your going to get
    Pete

  • If I'm already paying 149.99 to replace my water damaged Iphone 4 can I pay the Iphone 4s replacement price and get that instead? If No explain why please . Thank you

    I have a water damaged Iphone 4 I have had for only 8 months. Today I went to the apple store to see how much a replacement was and the girl told me 149.99 for my iphone. What I was wondering is can i pay the replacment cost of an Iphone 4s and get that instead . I dont see the problem since my phone is broken anyways . But I would like to hearf if any one has tried the same thing.
    Thanks

    The only exception would be if there were no like models available.  There was a short period when there were not sufficient supplies of the 3gs to effect warranty replacements.  In that case, they replaced the 3GS with a 4 at no additional charge.  But the warranty fine print specifies that they will repair or replace the device, at their discresion. 

  • I need a clarification : Can I use EJBs instead of helper classes for better performance and less network traffic?

    My application was designed based on MVC Architecture. But I made some changes to HMV base on my requirements. Servlet invoke helper classes, helper class uses EJBs to communicate with the database. Jsps also uses EJBs to backtrack the results.
    I have two EJBs(Stateless), one Servlet, nearly 70 helperclasses, and nearly 800 jsps. Servlet acts as Controler and all database transactions done through EJBs only. Helper classes are having business logic. Based on the request relevant helper classed is invoked by the Servlet, and all database transactions are done through EJBs. Session scope is 'Page' only.
    Now I am planning to use EJBs(for business logic) instead on Helper Classes. But before going to do that I need some clarification regarding Network traffic and for better usage of Container resources.
    Please suggest me which method (is Helper classes or Using EJBs) is perferable
    1) to get better performance and.
    2) for less network traffic
    3) for better container resource utilization
    I thought if I use EJBs, then the network traffic will increase. Because every time it make a remote call to EJBs.
    Please give detailed explanation.
    thank you,
    sudheer

    <i>Please suggest me which method (is Helper classes or Using EJBs) is perferable :
    1) to get better performance</i>
    EJB's have quite a lot of overhead associated with them to support transactions and remoteability. A non-EJB helper class will almost always outperform an EJB. Often considerably. If you plan on making your 70 helper classes EJB's you should expect to see a dramatic decrease in maximum throughput.
    <i>2) for less network traffic</i>
    There should be no difference. Both architectures will probably make the exact same JDBC calls from the RDBMS's perspective. And since the EJB's and JSP's are co-located there won't be any other additional overhead there either. (You are co-locating your JSP's and EJB's, aren't you?)
    <i>3) for better container resource utilization</i>
    Again, the EJB version will consume a lot more container resources.

  • (AS3) How to divide my code into classes/package

    Anyone familiar with this? I have already tried dividing
    among classes and it is not working.
    I have created the following code that pulls data from an
    external xml file into a datagrid. I have been trying to figure out
    how to get it to function using classes and/or packages. I'd like
    to separate the functionality into separate classes for each of the
    following:
    1) A class for loading the XML file(s) (there will likely be
    more datagrids and more xml files)
    2) A class for "drawing" the datagrid based on the xml
    .... others you can think of??
    I have attached the code in question.
    Thanks,
    Mark

    Classes in AS3 need to be in packages now, e.g.:
    // package needs to be included in same directory with FLA or
    in class look up targets
    package {
    // import statements go here
    // needs to be public for access outside of package
    directory
    public class NewXMLClass {
    // again public makes it accessible to other classes
    public function NewXMLClass() {}
    // inlcude your methods here
    use an import statement to use it in other classes e.g.
    import NewXMLClass;
    Hope that helps...

Maybe you are looking for

  • Browser Alignment incompibilities

    I am trying to center a form on my page using css, text-align:center. This works fine in internet explorer. In firefox, however, the form stays left. Here are two pictures: Internet Explorer: Firefox: =================================================

  • Combobox Parameters

    Greetings,      I have a cascading parameter extracted from a query. After assignment (in data filtering option) to the fields the parameter splits into parameter-field1 and parameter-field2. Parameter-field1 is a combo box and parameter-field2 is pa

  • JSF Page extending a template page contains no facet tags

    Using JDeveloper 11g Version 11.1.2.1.0 With an ADF Fusion Web Application I created a JSF template page by following this link: [http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/adf_richclient/adfrichclient.htm] However, when I create a JSF pa

  • How Create New Folder in KM with Name having Special Character

    Hi, How to create new Folder in KM with name having special character in it. Right now its not allowing me to create folder when i have Colon( as one of the character in name of the folder. Is there a way to change this validate? Any help is appricia

  • My yahoo toolbar does not start when I start firefox I have to redownload it why?

    why does my yahoo toolbar not work when I start firefox? i HAVE TO RE INSTALL IT EVERY TIME.