How to get the name of the local computer

Hi,
I want to be able to determine the name of the server that I am executing my program on. The only thing I can come up with is InetAddress.getLocalHost() and then call getHostName() but I was wondering whether there is an easier way? Any suggestions welcome.
Thanks,
Jim

Look in System.getProperties, maybe one contains what you want. I do not know them all by heart and I don'T have the time to check but I think I saw it once.
Regards

Similar Messages

  • How to get the local lan connecting all the system names ?

    how to get the local lan connecting all the system names using java?
    any body know then send the coding or solution

    This question is asked and answered repeatedly. Search the forum.

  • How can I get the local computer's ID and IP address in Labview?

    I want to get the local computer's ID and IP address, but i found i can't do it in labview.
    Could anybody do me a favor to give me some guidance?
    Thank very much!

    Under the Communication palette, under TCP, there are two functions you need to get this info':  'String to IP' and 'IP to String.'
    1.  Drop the String to IP function on the diagram. 
    2.  Do not wire any input to it. 
    3.  Take its Output and wire it to the 'net address' input of the 'IP to String' 
    5.  Display the Output of the 'IP to String' 
    Depenging on the True/False input to the 'IP to String' function, you get the machine name versus IP address. 
    See attachemnt... guess it's easier than explaining 
    Hope this helps.
    -Khalid
    Attachments:
    ip.png ‏2 KB

  • How to get the local file system path of an image that loaded into the image component in cq5?

    Hi,
    I'm having hard time uploading image from filesystem where as drag and drop works.
    I'm not getting a path of image selected from filesystem.
    here is my code..
    private String populateImage() throws Exception {
                        if (currentNode != null && currentNode.isNode()) {
                                       Node ImageNode = JcrResourceUtil.createPath(currentNode, "image",
                                                                          null, "nt:unstructured", true);
                                       imageUrl = ImageNode.hasProperty("fileReference") ? ImageNode.getProperty("fileReference").getValue().getString() : "";
           imageUrl = imageUrl.trim();
            log.info("MANAGE PROFILE BEAN IMAGE URL INSIDE IF IS: " + imageUrl);
                        } else {
                                            imageUrl = properties.get("fileReference", "");
                                            imageUrl = imageUrl.trim();
                                            log.info("MANAGE PROFILE BEAN IMAGE URL INSIDE ELSE IS: " + imageUrl);
                        return imageUrl;
    So if I drag and drop..
    ImageNode.hasProperty("fileReference") is returning a valid path
    but if I upload an image  it is returning Null.
    So how to get the path? any suggestions around would be appreciated...

    When you say path you mean you want the path to print out in your HTML? Is that accurate? If so you generally need to constructe that path based on the path to the current component. So if you component is located at /content/mysite/en/about/mypage/jcr:content/parsys/image then the path to the image would generally be something like /content/mysite/en/about/mypage/jcr:content/parsys/image.img.jpg/1283829292873.jpg. The .img. selector triggers the servlet associated with the foundation parbase - /libs/foundation/components/parbase/img.GET.java. The reason you reference it this way is that there is no filesystem path to the image - it is stored in the repository not on the file system, and it requires a servlet or script to ge the binary from the repository and steam it.
    Normally the way you'd construct this is to use the out of the box Image class - so look at /libs/foundation/components/image/image.jsp. Now this example assumes that your component where you loaded the image extends /libs/foundation/components/parbase. If it doesn't then you either have to change your sling:superResourceType to /libs/foundation/components/parbase or some other component that does exten /libs/foundation/components/parbase.

  • How to get the local IP address?

    Hi,
    I try to obtain the users local IP address similar to:
    InetAddress localHost= InetAddress.getLocalHost();
    String localIP = localHost.getHostAddress();
    InetAddress[] inetAddress = InetAddress.getAllByName(localHost.getHostName());
    for (int k = 0; k < inetAddress.length; k++)
       if(!inetAddress [k].getHostAddress().equals(localIP))
          return inetAddress [k].getHostAddress();
    }This code works fine in a stand alone application. When I try to use it in conjunction with Web Start it only returns 127.0.0.1.
    I think there's no Service from Web Start that gives me the users IP address. Or am I wrong?
    Does anyone know a solution for this?
    Thanks in advance!

    Hello,
    I use java.net.InetAddress.getLocalHost().getHostName();
    in my javaws and I get the real hostname.
    Probably your DNS is not correct,
    or other possible problem: sign your jars, so you get full access to the System resources.
    regards.

  • How to get the locale/region of the device?

    I want to retrieve the locale/region being used on the user's mobile device (doing this on iOS at the moment) and seem to be having difficulty figuring this out.
    I need to be able to distinguish between en_US, en_UK, en_CA etc.
    Capabilities.language & Capabilities.languages just seem to return the language "en" and not the locale/region being used for the device.
    I've also tried using
    var defaultLocale:LocaleID = new LocaleID(LocalID.DEFAULT);
    trace(defaultlLocale.getLanguage + "_" + defaultLocale.getRegion());
    But this just results in an output of "i-default_" (invalid language setting and empty region setting).
    Any ideas on what API calls I need to be using, or what I'm doing wrong?
    Thanks in advance

    Well it looks like if you go into the devices Settings->General->International->Language you can set the preferred language to "British English".
    This will then cause Capabilities.languages to return "en-GB" for the first element of the array (the prefferred language). Not sure why it doesn't use proper locale/region codes, but that's another discussion.
    The remaining issue is that there is no device setting for "Canadian English", so this doesn't completely solve my problem.
    iOS devices do also let you set the "Region Format" which does have a "Canada" setting. I'm guessing that I could use this as a work around if we have access to the "Region Format" data through some AIR API. Does anyone know if we have access to the "Region Format" information on iOS devices and how we'd access that information?
    Thanks.

  • How to get the local date time value

    Hi,
    I am Australian time zone. I have been using the below code to retrieve meeting start date time from my Sharepoint Calendar.
    Console.WriteLine((DateTime)oListItem["EndDate"]);
    This used to return the correct local date up until today. I simply read this and store in a database. Today when I check I can see that the date returned is different to what I can see in the Sharepoint calendar.
    For and example: In Sharepoint calendar I can see the date as "Oct 1 2014 5:30 PM". But my above code now returns "Oct 1 2014 6:30 AM". This looks to me like UTC time.
    But up until today my code above returned the correct local date. Is there any reason for this sudden chahge?
    When I read the TimeZone in sharepoint (using RegionalSettings.TimeZone method) it return the correct time zone too.
    Any help would be appreciated. I am concerned that I have to now go and change all places where I read the date time from sharepoint.
    Thanks, Bimal
    Bimal

    Hi,
    According to your post, my understanding is that you had some issue about the calendar time.
    As your code worked well before, the issue may be related to the calendar itself or the site.
    As the TimeZone is correct, you can recreate a new calendar to check whether it works.
    Or create a new site to check whether it works.
    I had made a simple demo to retrieve the calendar EndDate time, you can also check with it.
    using (SPSite site = new SPSite("http://YourSiteURL "))
    using (SPWeb web = site.OpenWeb())
    SPList spList = web.Lists.TryGetList("Calendar1");
    if (spList != null)
    SPQuery qry = new SPQuery();
    qry.ViewFields = @"<FieldRef Name='EventDate' /><FieldRef Name='EndDate' />";
    SPListItemCollection listItems = spList.GetItems(qry);
    foreach (SPListItem item in listItems)
    string startTime = item["EventDate"].ToString();
    string endTime = item["EndDate"].ToString();
    Console.WriteLine("Start Time:"+startTime);
    Console.WriteLine("End Time:"+endTime);
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • [JFileChooser] How to get the local network servers list?

    Hi, i try to use a JFileChooser (and its FIleSystemView) to retreive the list of local network computer.
    In the UI, i can see it but i don't manage to get that list outside of the jfilechooser.
    When I do : new File(\\\\Server\\Directory).list() I have a good answer.
    But hen I do new File(\\\\).list() to have the server list, i have nothing. I don't manage to list the workgroup too.
    Thanks a lot.

    This question is asked and answered repeatedly. Search the forum.

  • Getting the local full path name of a file from an item File Browser

    Hi all,
    I would like to get the local full path name, of a file selected from an item 'File browser'.
    I see in wwv_flow_files the column 'name', but actually it's a kind of id like 'F1542335/myFile.gif' for example.
    What i want is the local path of this file ("C:\Documents and Settings\All Users\....\myFile.gif").
    I hope this is possible??
    Anyway, thanks all for reading.
    Ludo

    Hello, thank you for the answer.
    Please understand that I searched before posting, and not ony 15 min.
    What i mean is that the value of a File Browser in an Apex applocation is something like 'F1542335/myFile.gif', but what I need is the local path location.
    And 'F1542335/' is not the local path location, i can't use it. Or maybe there is a way to convert it in a proper path name, such as "C:\Documents and Settings\....", but I don't think so.
    So my question is : how to get the local path name of a file in Apex?
    I'll answer if I find some good things.
    Thanks
    Ludo
    Edited by: user12945874 on 06-avr.-2010 3:59

  • How to get the pull path name from a file upload window

    Hello everyone!
    I have encountered the following problem with the following JSP code:
    <form method="post" action="filename.jsp">
    Upload JAVA program:
    <input type=file size=20 name="fname" accept="java">
    <input type=submit value="go">
    </form>
    <%
    String s = "";
    if (request.getParameter("fname") != null)
    s = request.getParameter("fname")
    %>
    The value of s is alway the filename. However I want to get the full path in addition to the filename, so that I can read the file. Does anyone know how to get the pull name of the file?
    thanks a lot in advance,

    Dear Sir,
    thanks a lot for your reply. Please let me explain what I intended to do: I want to upload a file from the local machine and then read the content of the file. Therefore I need to the fullpath of the filename like /var/local/file.java instead of file.java. The latter is what I got.
    The problem I have with your code is that the function like "request.getServerScheme()" is not recognized. Maybe is it because I didn't install servelet package? I only installed javax package btw. Also my application runns on Tomcat server if this could give you some information. The error message I had is as follows:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:133: cannot resolve symbol
    symbol : method getServerScheme ()
    location: interface javax.servlet.http.HttpServletRequest
    url = request.getServerScheme()
    ^
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:136: cannot resolve symbol
    symbol : method getServerScheme ()
    location: interface javax.servlet.http.HttpServletRequest
    + ((("http".equals(request.getServerScheme()) && request.getServerPort() != 80)
    ^
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:137: cannot resolve symbol
    symbol : method getServerScheme ()
    location: interface javax.servlet.http.HttpServletRequest
    ||("https".equals(request.getServerScheme()) && request.getServerPort() != 443))
    ^
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:139: cannot resolve symbol
    symbol : method getServletConfig ()
    location: interface javax.servlet.http.HttpServletRequest
    + "/" + request.getServletConfig().getServletName()
    ^
    An error occurred at line: 36 in the jsp file: /addExercise.jsp
    Generated servlet error:
    /usr/local/jakarta-tomcat-5.0.12/work/Catalina/localhost/tutor/org/apache/jsp/addExercise_jsp.java:140: cannot resolve symbol
    symbol : variable path
    location: class org.apache.jsp.addExercise_jsp
    + "/" + path
    ^
    5 errors
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:128)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:413)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

  • How to get the absolute path of a file from the local disk given the file n

    how to get the absolute path of a file from the local disk given the file name

    // will look for the file at the current working directory
    // this is wherever you start the Java application (cound be C: and your
    // application is located in C:/myapp, but the working dir is C:/
    File file = new File("README.txt"); 
    if (file != null && file.exists())
        String absolutePath = file.getAbsolutePath();

  • How to get the full path or name of the Layer to which Filter is applied?

    Hi All,
              I have created a layer using some background image as source. How to get the name or ful path of the background image?
    I checked the documentation and found GetPathNameProc(SPPlatformFileSpecification*) function, but I couldn't get the parameter SPPlatformFileSpecification*.
    Is there any other way to get the file path of background layer in my custom filter?
    Thanks,
    Dheeraj

    If this is a client side application then I'd say look into drag-n-drop tutorials.
    i.e. drag file to your application, action listener fires, create File object giving you full name and path of users action.
    If this is a web application then look into the "multipart/form-data" content type specifications on how to upload files.
    i.e. user specifies file from <input type='file' ... /> type, submits, servlet receives data and recreates file locally on application server side.
    If you are thinking that all you need to send a file to a program is the full path and name in a textbox its a little bit more complicated then that.
    Good luck, hope that helps!

  • How to get the Portal Page name from PLSQL?

    Can anyone tell me how to get the portal page name from my dynamic page using plsql?
    Apparently you can get the page id and work it out from there, but my calls to get the page id are not returning any values anyway.
    My code for attempting to get the page id is below.
    <oracle>
    declare
    v_pageid varchar2(30);
    begin
    v_pageid := wwpro_api_parameters.get_value('_pageid', '/pls/portal30');
    htp.print('Page is '|| v_pageid);
    end;
    </oracle>
    Ideally I'd actually just like to get the page name. Is there a straightforward way to do this?
    Thanks in advance!
    Sarah

    Few clarifications -
    1. wwpro_api_parameters cannot be used to get default portal
    page parameters such as '_pageid', '_dad', '_schema' etc.,
    2. Page information can be obtained through any components which
    are available in that particular page. For example, in case of
    dynamic page, we need to publish it as a portlet and add it to the
    page. This process creates necessary packages in the DB, but we
    will not have access to the portlet methods.
    So, I would prefer creating a simple DB provider & portlet and access
    page title from its show method as follows -
    //Declare local variable l_page_id, l_page_title as varchar2
    select page_id into l_page_id from wwpob_portlet_instance$ where
    portlet_id = p_portlet_record.portlet_id and
    provider_id = p_portlet_record.provider_id;
    select name into l_page_title from wwpob_page$ where id=l_page_id;
    More information on DB provider can be found at
    http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/articles/understanding.database.providers.html
    Secondly, usage of wwpro_api_parameters.get_value method is
    incorrect. This method expects two arguments -
    <ul>
    <li><b>p_name : </b> The name of the parameter to be returned.</li>
    <li><b>p_reference_path : </b> An unique identifier for a portlet instance on the current page.</li>
    </ul>
    p_reference_path would be something like 99_SNOOP_PORTLET_76535103 and not some type of path as its name suggests.
    The following code fragment fetches all parameters available
    for a portlet.
    Note : Copy this code into 'show' method of your portlet.
    //Declare l_names, l_values as owa.vc_arr
    * Retreive all of the names of parameters for this portlet
    l_names := wwpro_api_parameters.get_names(
    p_reference_path=>p_portlet_record.reference_path);
    * Retreive all of the values of parameters for this portlet
    l_values := wwpro_api_parameters.get_values(p_names=>l_names,
    p_reference_path=>p_portlet_record.reference_path);
    //Loop through these arrays to get parameter information
    htp.p('<center><table BORDER COLS=2 WIDTH="90%" >');
    htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
    htp.tableData(wwui_api_portlet.portlet_heading('Name',1));
    htp.tableData(wwui_api_portlet.portlet_heading('Value',1));
    htp.tableRowClose;
    if l_names.count = 0 then
    htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
    htp.p('<td COLSPAN="2">'
    ||wwui_api_portlet.portlet_text(
    'No portlet parameters were passed on the URL.',1)
    ||'</td>');
    htp.tableRowClose;
    else
    for i in 1..l_names.count loop
    htp.p('<tr ALIGN=LEFT VALIGN=TOP>');
    htp.tableData(l_names(i));
    htp.tableData(l_values(i));
    htp.tableRowClose;
    end loop;
    end if;
    htp.p('</table></center>');
    Hope it helps...
    -aMJAD.

  • How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    If the data is on a remote server (for example, PHP running on a web server, talking to a MySQL server) then you do this in an AIR application the same way you would do it with any Flex application (or ajax application, if you're building your AIR app in HTML/JS).
    That's a broad answer, but in fact there are lots of ways to communicate between Flex and PHP. The most common and best in most cases is to use AMFPHP (http://amfphp.org/) or the new ZEND AMF support in the Zend Framework.
    This page is a good starting point for learning about Flex and PHP communication:
    http://www.adobe.com/devnet/flex/flex_php.html
    Also, in Flash Builder 4 they've added a lot of remote-data-connection functionality, including a lot that's designed for PHP. Take a look at the Flash Builder 4 public beta for more on that: http://labs.adobe.com/technologies/flashbuilder4/

  • How to get column names for a specific view in the scheme?

    how to get column names for a specific view in the scheme?
    TIA
    Don't have DD on the wall anymore....

    or this?
    SQL> select text from ALL_VIEWS
      2  where VIEW_NAME
      3  ='EMP_VIEW';
    TEXT
    SELECT empno,ename FROM EMP
    WHERE empno=10

  • How to get the date in local language

    Hi,
    I want display "Date" in Local language. Written code as below to display date in my RTF Template:
    <?format-date:xdoxslt:sysdate_as_xsdformat();'dd'?><?' '?><?xdoxslt:month_name(substring(xdoxslt:sysdate(),3,2), 0, $_XDOLOCALE)?><?' '?><?format-date:xdoxslt:sysdate_as_xsdformat();'yyyy'?>
    Output showing in my RTF template as "26 May 2011". which is correct for englilsh.
    want to display same format in Local languge for example in Germany :
    26 mai 2011
    To get the local language format tried 1) by Putting "DEU" instead of "$_XDOLOCALE" 2. Tried by declaring a variable with value as "DEU"
    But it two cases it showing in english format not in Germany Language. Please give me idea how to get date in local language.
    Thanks
    -Chakri..

    Dont think you have anyway to tell the target language for a single text retrieval. You can obviously set the locale of the user but that will change language of other texts also. If you always want to show some predefined text in English then better you dont keep the those texts at all in the translated files. Or you keep the English text in all the files - so that everytime English only gets displayed. But if your case is a selective one - i.e. you want to show English text to only German users but spanish to Spanish and French to French then I dont have any answer how to achieve the same.
    Regards,
    Shubhadip

Maybe you are looking for

  • Error while deploying SOA domain template using OVAB

    This error occurred while deploying SOA domain template using OVAB. Can anyone tell me what is the cause of this error and how can I correct it??? [as] [TRACE] [] [oracle.as.assemblybuilder.fcp] [tid: 62] [SRC_CLASS: oracle.as.assemblybuilder.fcp.uti

  • IPod reloads entire video file when I make changes to video's info?

    Just got the 80GB video for Xmas. When I sync after making changes to the info data (name, category, year etc) in iTunes, the entire movie "reloads", as if I am syncing a movie to the iPod that I've never synced before. It overwrites the older versio

  • N8 FM Transmitter No Longer Transmits internet rad...

    i have had my N8 for over a year now, and until the recent update, I use to be able to transmit the internet radio thru the N8 FM transmitter, Now when i try and use it as soon as I turn on the transmitter, internet radio stops, then when i try to cl

  • Can't find a song

    I have downloaded a song form iTunes and transferred it to my phone but it does not show up.  A search of my phone library using my PC show that it is there but it does not show up in any of my libraries on the phone.

  • Firefox 4 and 5 not working on Dell Studio XPS 64 bit

    Mozilla installs OK but when open I can't surf.....tabs do not open Even 3.6.18 gives problems...Facebook page keeps refreshing when trying to write comments, some sites lagging in opening