How get windows username

Hi,
In my java application I have following code to get windows username-
*<%*
String s1 = System.getProperty("user.name");
out.println("The Username : "+s1+" ");
String s2 = System.getenv("USERNAME");
out.println("The Username : "+s2);
*%>*
If I log in to my PC and execute it I get correct output for both the statements, But when I execute it on server machine(when I logged in) I get the output as-
The Username : SYSTEM The Username : null
I use Apache Tomcat 5.5 to run the jsp on both (PC & server) machines. One small difference is I use eclipse on my PC and I don't use eclipse on server (I think it doesn't matter).
But when I use the same code inside a java class I get correct output on both (PC & server) machines.
Can any one solve my problem.
Thanks in advance,
Tiijnar

tiijnar wrote:
Hi BalusC,
Thanks for the reply.
Could you please be more elaborted on this. What I mean is- can you provide me the code for the applet.Just the same code. Use System#getProperty() in an applet. The only difference is that the applet runs at the client machine and the Java web application runs at the server machine. If your problem is rather that you don't know how to use applets, just check the applet tutorial here at sun.com. Google can find it.
Moreover when I execute jsp on my PC, I execute it on localhost (a server inside my PC). I face the problem when I host my application on my server machine.D'oh. On "localhost" the client and the server are physically on the same machine.

Similar Messages

  • How to get windows username printed on each page irrespective of application? we have cm6030f.

    How to get windows username printed on each page irrespective of application? we have HP CM6030F.

    Hi,
    Normally, you will receive a Windows Azure Pass from your local Windows Azure team. Please try to contact your local Windows Azure contact (http://support.microsoft.com/gp/customer-service-phone-numbers?wa=wsignin1.0
    Also, you could see this page
    http://www.windowsazurepass.com/AzureU/AcademicFAQ and apply the free trial azure via (http://www.windowsazurepass.com/AzureU/).
    Q: I am a student. Can I apply for a pass?                     
    A: Windows Azure Educator Grants are only for valid faculty. If your faculty has been awarded a Windows Azure Educator Grant, you will be able to get a pass through him/her for you coursework. If you are interested in learning more about Windows Azure,
    we encourage you to share these Educator Grants with your faculty or sign up for the FREE 3-month trial offer. 
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get windows username & password

    Hi friends,
    Requirement is to get windows username & password,
    My server is Tomcat4.0,
    My code in login.jsp page is
    <%
    String auth = request.getHeader("Authorization");
    if (auth == null) {
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "NTLM");
    return;
    if (auth.startsWith("NTLM ")) {
    byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
    int off = 0, length, offset;
    String s;
    if (msg[8] == 1) {
    off = 18;
    byte z = 0;
    byte[] msg1 = {(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',
    (byte)'S', (byte)'P', z,
    (byte)2, z, z, z, z, z, z, z,
    (byte)40, z, z, z, (byte)1, (byte)130, z, z,
    z, (byte)2, (byte)2, (byte)2, z, z, z, z, //
    z, z, z, z, z, z, z, z};
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "NTLM "
    + new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());
    return;
    else if (msg[8] == 3) {
    off = 30;
    length = msg[off+17]*256 + msg[off+16];
    offset = msg[off+19]*256 + msg[off+18];
    s = new String(msg, offset, length);
    //out.println(s + " ");--------------------------> here getting system_name
    else
    return;
    length = msg[off+1]*256 + msg[off];
    offset = msg[off+3]*256 + msg[off+2];
    s = new String(msg, offset, length);
    //out.println(s + " ");
    length = msg[off+9]*256 + msg[off+8];
    offset = msg[off+11]*256 + msg[off+10];
    s = new String(msg, offset, length);
    out.println("Hello <span style='position:relative; width:190;"
    + " height:10;filter:glow(Color=#009966,Strength=1)'>");
    out.println(s + "</SPAN>");----------------------------------->here getting loginname.
    %>
    from this i was able to get systemname & username,How do i get password.
    Is it possible to get password?
    Thanks,
    Satya.

    There's no way to get the password. NTLM uses a two-round challenge-response scheme which never send the password (neither clear nor encrypted) on the wire.
    Why do you need the user's password? Is your service going to access a backend service using the user's credential? If so, you may need to use Kerberos delegation.

  • Getting Windows Username In A Page

    Hello,
    I am currently developing an application that requires to know the Windows username, these are generic and will be used as a terminal. I was wondering if it is possible to get this information? I know I can use javascript and a active x control but I don't really want to go down that route.
    Our technology stack is:
    Apex 4.2.2.00.11
    Apex Listener 2
    Oracle 10g, 10.2.0.4.0
    Thanks,
    Paul.

    Here's a barebones script that you can call from a script in your form to retrieve the login name of the user:
    // Folder-level JavaScript function
    var getLoginName = app.trustedFunction(
        function () {
            // Get and return the user's login name
            app.beginPriv();
            return identity.loginName;
            app.EndPriv();
    This needs to be included in a JavaScript file that's installed in the correct location. It's just a text file, so you can create/edit it with a text editor, but make sure the extension is ".js". For more information about how to determine where to place the file, see: http://acrobatusers.com/tutorials/2006/folder_level_scripts
    More information on all of this is in the Acrobat JavaScript reference: http://www.adobe.com/devnet/acrobat/javascript.html
    To populate a text field with the login name, do something like:
    // Populate field with loginName
    getField("text1").value = getLoginName();
    Change "text1" with the actual name of the field in your form. You can place this code in a document-level JavaScript so it executes when the form is opened.
    Note that all of this code is the bare minimum, and you may want to expand it to check for errors, etc.

  • How 2 get WINDOWS USERNAME in a JSP

    <%@ page import="sun.misc.BASE64Encoder" %>
    <%
    String auth = request.getHeader("Authorization");
    if (auth == null) {
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "NTLM");
    return;
    if (auth.startsWith("NTLM ")) {
    byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
    int off = 0, length, offset;
    String s;
    if (msg[8] == 1) {
    off = 18;
    byte z = 0;
    byte[] msg1 = {(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',
    (byte)'S', (byte)'P', z,
    (byte)2, z, z, z, z, z, z, z,
    (byte)40, z, z, z, (byte)1, (byte)130, z, z,
    z, (byte)2, (byte)2, (byte)2, z, z, z, z, //
    z, z, z, z, z, z, z, z};
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "NTLM "
    + new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());
    return;
         else if (msg[8] == 3) {
    off = 30;
    length = msg[off+9]*256 + msg[off+8];
    offset = msg[off+11]*256 + msg[off+10];
    s = new String(msg, offset, length);
    out.println(s + " ");
    else
    return;
    %></BODY>

    Please use Code tags
    Any of theses answer your question?
    Ohh, wait that code is a direct copy of the first two posts.
    What is wrong with it?

  • How get window between selection screen and alv output

    Hi Friends,
    I am displaying ALV report now i want to display small window with one button and it should show list of fields before displaying alv output.
    means i want a window showing list of fields of internal table coming from program.and when i will click on yes button it should show ALV output.
    how can i achive this .
    Pls. help
    thanks in advance.

    Hi,
    Try to use the following command:
    <b><i>WINDOW STARTING AT <some-value> <some-value> ENDING AT <some-value> <some-value>.
    </i></b>
    notice that there is a space between <> <>.
    This statement should be used inside the AT USER-COMMAND event.
    i.e.,
    AT USER-COMMAND.
       CASE SY-UCOMM.
           WHEN 'XXX'.
                <b> <i> WINDOW STARTING AT <> <> ENDING AT <> <>.</i></b>
                 ..............statements....................
       ENDCASE.
    This should help you some what.
    Bye

  • Getting Windows Username of the Client m/c

    Hi,
    I want to be able to get the userid of a person when they call a servlet which is residing on a server.
    The person will log into his own computer using his user id and when he calls my servlet which
    is on my server over a network, I will be able to retrieve his user id .
    Thanx in advance
    bye

    Why don't you include these informations with the POST (or GET) message to the servlet?
    just use:
    http://....../servlet?userLogin=User Name&userPassword=765
    at the servlet, you can retrieve these info using the getParameter() command:
       public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    String usrId = request.getParameter("userLogin");
    String usrPassword = request.getParameter("userPassword");
    .....

  • How to get the windows username in jsx

    Hello,
    I have a JSX script in "My Documents\Adobe Scripts" to make it trusted script. I have another text file I need to read from JSX. Since the location depends on logged in user, I need to find the windows username. If anyone know how to get the windows username from jsx please reply.
    Thank you very much.
    Regards
    Nima.

    Hey,
    You can get username like this:
    var myUsername = $.getenv('username');
    You could also get My Documents folder like this:
    var myDocFolder = Folder.myDocuments;
    Hope that helps.
    Marijan (tomaxxi)
    http://tomaxxi.com/

  • HDD failure, I'd like to know how to get Windows 7 back on it.

    Hello everyone, I've had a HDD issue lately, but before I move on to describe my issue, here are the specs of my notebook:
    HP Pavilion dv6-3264ca
    AMD Triple-Core CPU 2.2 Ghz
    6GB RAM
    128MB ATI Graphic Card
    750GB Toshiba HDD
    Windows 7 64-bit
    The issue:
    Recently I've had a very unfortunate HDD failure. The recovery partition wouldn't even load. I tried booting my notebook on Linux with the HDD still attached, and it wouldn't read. I extracted the HDD and placed it in an HDD-enclosuer and it still wouldn't load on Windows XP or Vista or 7. It would however read in the device manager of Windows and also in the BIOS.
    I needed to extract some high-priority data from there so I managed to retrieve all my data safely through a data recovery service, but now the drive is rendered useless. I was told a low-level format might be able to help it be usable again, and if that were to happen, the recovery partition would then be removed in the process. 
    In addition to that, I would like to install Windows 7 64-bit onto the drive, but the notebook box did not come with an installation CD, which is quite frustrating. Is there any way HP can let me download Windows 7 through some warranty service?
    I have a one-year warranty on my laptop.
    So in closing, I would like to know if I can get Windows 7 back onto my HDD for free, or if I need to go about buying Windows 7 again.
    Any advice from you kind folks?
    This question was solved.
    View Solution.

    Hi,
    Here are Two options.
    1.  If you have ( or can borrow ) a retail Windows 7 installation disc that is exactly the same version as your OEM installation - ie if your notebook came with Windows 7 Home Premium 64bit this is the exact retail version you would need.
    If you don't have access to a retail disc, you can create an installation disc yourself - just download the correct Disc Image from the link below and use an application such as ImgBurn to burn the ISO correctly to a blank DVD.
    http://www.mydigitallife.info/download-windows-7-iso-official-32-bit-and-64-bit-direct-download-link...
    Use the disc to perform the installation, enter the Windows activation key found on the underside of your notebook when requested and when the installation has completed, use the 'Phone Method' detailed in the link below to activate the OS - this method supported by Microsoft and is popular with people who just want a clean installation of Windows 7 without the additional software load normally bundled with OEM installations.
    http://www.kodyaz.com/articles/how-to-activate-windows-7-by-phone.aspx
    Any additional drivers you may need can be found Here.
    2.  You can order a replacement set of Recovery Discs using the link below - these cost around $30 if you live in the US.
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c00810334&cc=us&lc=en&dlc=en
    If you have any problem with this link, order them directly from HP.
    If you live in the US, contact HP Here.
    If you are in another part of the world, start Here.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • *** How to get the username in a custom password change routine....

    How to get the username in a custom password change routine / procedure / form when a user's password has expired and is redirected automatically to this custom program?
    We use the 2nd parameter in LOGIN_URL column in WWSSO_LS_CONFIGURATION_INFO$ table to get to this custom change-password proc.

    OK !
    Use that maybe good :
    select USERID into v_user from sys.aud$
      where ntimestamp#=(
      select max(ntimestamp#)
      from sys.aud$ );

  • My iPod Classic is not detected by my Windows 8 computer when I connect it via USB port.  How can I get windows to detect this device?

    My iPod Classic is not detected by my Windows 8 computer when I connect it via USB port.  How can I get windows to detect this device?  A message from windows says: the device has malfunctioned.

    Try TS1363: iPod: Appears in Windows but not in iTunes.
    See also Corrupt iPod classic.
    tt2

  • How do I get windows to connect to the internet on my iMac

    How do I get Windows 7 Home Premium to connect to my existing internet connection, on my iMac (Lion 10.7.3)?  The installation of the Windows 7 using Bootcamp went fine, up to the point of getting connected to the internet.  My iMac side of the partition connects to the internet just like it always did.

    You should ask this in the boot camp forum.
    You will probably get more help there.

  • Trying to download update to iTunes in Vista but get Windows installer error. How do I update?

    Trying to download update to iTunes but get Windows Installer error.  How do I correct?

    many thanks.
    "There is a problem with this Windows Installer package.  A program required for this install to complete could not be run.  Contact your support personnel or package vendor."
    Perhaps let's first try updating your Apple Software Update.
    Launch Apple Software Update ("Start > All Programs > Apple Software Update"). Does it launch and offer you a newer version of Apple Software Update? If so, choose to install just that update to Apple Software Update. (Deselect any other software offered at the same time.)
    If the ASU update goes through okay, try another iTunes install. Does it go through without the errors this time?

  • How to get Windows Server 2012 trial license key?

    How to get Windows Server 2012 trial license key? I'm trying to install WinServer 2012 Trial on a VMWare Workstation 9. I'm asked for the product key during set up. If I ignore putting in the key (since I don't have one) The install fails stating no valid
    key. I tried this with Oracle's Virtual Box and the same thing happens. I tried using Majic JellyBean to find the key, but that only works on pre-installed OS. A Technet article said to use aaaa-bbbbb-ccccc-ddddd etc. in the spaces. That doesn't work either.
    Articles all over the web seem to have other people in the same boat. Please help :)

    Download the trial version from here -
    http://www.microsoft.com/en-us/server-cloud/evaluate/trial-software.aspx  It does not require a key.  If the software is asking for a key, it is not the trial copy.  Where did you get your copy?
    .:|:.:|:. tim

  • How can I get Windows (v7 x64) to open in Dreamweaver (CS5) if I right click it?

    Hi
    How can I get Windows (v7 x64) to open in Dreamweaver (CS5) if I right click it?
    None of the normal mechanisms of setting an application to be the DEFAULT application for the .HTML file type seem to work...
    Extremely irritating.
    J

    Jon Fritz II wrote:
    So when you right-click an .html file and choose Open With, what are you seeing?
    Is the check box for "Always use the selected program to open this kind of file" checked?
    A list of various "recommended applications" but not including Dreamweaver. It's not in the list of Other Applications either. And if I browse for it, my selection of dreamweaver.exe is flatly ignored without message.
    >Is the check box for "Always use the selected program to open this kind of file" checked?
    Jon Fritz II wrote:
    So when you right-click an .html file and choose Open With, what are you seeing?
    Is the check box for "Always use the selected program to open this kind of file" checked?
    A list of various "recommended applications" but not including Dreamweaver. It's not in the list of Other Applications either. And if I browse for it, my selection of dreamweaver.exe is flatly ignored without message.
    > Is the check box for "Always use the selected program to open this kind of file" checked?
    Yes.
    J

Maybe you are looking for