How to get jdk installation directory programmatically?

when we install jdk, we can select a directory to install it, i.e.
F:\myfolder\jdk1401
this is not JRE directory and can not be got by java method System.getProperties()
my Q is:
how to get the directory progammatically in Java program?
thx

Most commercial software gives the user the oppotunity to specify the JDK they want to use. Some search for the JDK for them, but often involve a directory search. The registry trick should work, but you need to check the directory still exists. The user can move/delete it without the registry being updated, this is very easy if the drive is a network drive.
Note:
if the jdk is installed on a network drive, the registry may not be setup for each user. They can see it but it does not appear in the registry.
If you setting up a web server e.g. tomcat, it typically runs as a different login id to the user installing it. Network drives are different for different users, so network drive letters may not work. Using the UNC instead of the drive letter can get around this problem.
If the user tries to install his run anay where software on a non-windows system, there will be no registry.
Good Luck.

Similar Messages

  • How to get JDK installation path

    Hi,
    I would like to get JDK installation path in linux, is there any way to get the same.
    For example I have installed JDK in "/usr/java/j2sdk1.4.1" I need this path..
    It would be great if any one help me solve this.
    Thanks in advance.
    Regards,
    Venkat

    hi,
    System.getProperty("java.home");

  • How to get J2EE installation directory?

    when we install J2EE, we install it in a directory, i.e.
    c: \ j2sdkee1.4
    but how to get the directory programmatically on Windows OS using Java or C++ launguage?
    thx

    bring to top to get answer

  • Get installation directory programmatically

    is it possible to get user installation directory of jdk programmatically?
    i.e. j2se was installed to
    f:\mydir\jdk14
    how to get the directory in java program?
    java.home is run-time environment directory looks like c:\program file\..., not user installation directory i needed.
    thx

    The JDK is usually NOT installed in the same place as the JRE.We are obviously talking about different things.
    In my JDK C:\j2sdk1.4.2_05 there is a JRE C:\j2sdk1.4.2_05\jre
    They can be installed in different places but I assume you are talking about different installs in different places. i.e. the JDK and JRE have been installed seperately.
    I need to obtain user installation directory programmatically You can look at the PATH and the registry. However if the user installs more than one JDK, which copy are you going to chose. Most applications which need a seperate JDK search for the JDK when installed and then ask the user which JDK to use.
    - System.getProperties() will not get the directory - i have tested with all jdks and all windows OS.
    One thing you can do with ant is to write the directory used to build an application into the application for it to find. I would concider this bad practice and unreliable however.
    who can answer my Q?The reason the JDK is seperate from the JRE is so that once development has be done you can run the JRE and not need the development portions which come with the JDK. If you need still need components of the JDK, why don't you start the application in the JDK.

  • How to get the \filter directory from registry (or other) during installation of the plugin

    Hello
    I made a script to install the plugin because it needs some libraries to be installed as well, but during the installation, the filter directory isn't defined (it isn't the same for each platform or language)
    for example my filter folder is :
    E:\Program_Files\Photoshop CS2\Modules externes\Filtres
    how do i get this filter directory from registry (or with another way)
    thanks a lot
    Jeff

    sorry i made a little mistake (didn't poste the updated version of my code)
    here is the right code:
    [Code]
    var
      maxnb8bf : Integer;
      maxDirectory:        String;
      nb8bf : Integer;
      PreviousDirectory:        String;
    procedure ProcessDirectory (RootDir: String; Progress: Boolean);
    var
    NewRoot:        String;
    FilePath:        String;
    FindRec:        TFindRec;
    n1 : Integer;
    n2 : Integer;
    begin
    NewRoot := AddBackSlash (RootDir);
    if FindFirst (NewRoot + '*', FindRec) then
    begin
    try
    repeat
    if (FindRec.Name <> '.') AND (FindRec.Name <> '..') then
    begin
    FilePath := NewRoot + FindRec.Name;
    if FindRec.Attributes AND FILE_ATTRIBUTE_DIRECTORY > 0 then
    ProcessDirectory (FilePath, Progress)
    else
    begin
            if (NewRoot <> PreviousDirectory) THEN
            begin;
               if (maxnb8bf < nb8bf) THEN
               begin;
                   maxnb8bf := nb8bf;
                   maxDirectory := PreviousDirectory;
               end;
               nb8bf := 0;
            end;
            n1 := Pos('.8bf', FilePath);
            n2 := Pos('.8BF', FilePath);
            if ((n1 > 0) or (n2 > 0)) THEN
            begin;
               nb8bf := nb8bf + 1;
            end;
            PreviousDirectory := NewRoot;
    end;
    end;
    until NOT FindNext (FindRec);
    finally
    FindClose(FindRec);
    end;
    end;
    end;
    function InitializeSetup(): Boolean;
    var
      V: string;
    begin
      if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Photoshop.exe', 'Path', V) then
        MsgBox('Value is "' + V + '"', mbInformation, MB_OK);
      Result := TRUE;
       maxDirectory := '';
       nb8bf := 0;
       PreviousDirectory := '';
       maxnb8bf := 0;
       ProcessDirectory (V, true);
       //if (maxDirectory <> '') THEN
       // begin;
       //      MsgBox('Value is "' + maxDirectory + '"', mbInformation, MB_OK);
       // end;
    end;
    function NewTargetDir(Param: String): String;
    begin
      Result := maxDirectory;
    end;
    Regards

  • How to get the page layouts programmatically and create a page for that pagelayout

    how get the page layouts programmatically and create a page for that pagelayout and add webpart
    please help me with da code.Thanks
    adityadugyala

    Hi if your page layouts alreday created then create new page programaticaaly  and apply your page ayouts to that page by coding you can do something like following
    PublishingWeb publishingWeb =
    PublishingWeb.GetPublishingWeb(web);
    PageLayout[] layouts = publishingWeb.GetAvailablePageLayouts();
    PageLayout layout = layouts[0];
    string pageName =
    "MyPublishingPage5.aspx";
    PublishingPage newPage = publishingWeb.GetPublishingPages().Add(newFolder.Folder.ServerRelativeUrl +
    "/"+ pageName, layout); 
    newPageUrl = web.Url +"/" + newPage.Url;
    newPage.Description = "This my sample publishing page";
    newPage.Title = "My Publishing Page";
    newPage.Update();
    Please follow link
    http://blogs.msdn.com/b/sowmyancs/archive/2008/03/15/create-publishing-pages-in-portal-sites-programmatically.aspx
    Please mark answer , if you think answer is helpful or correct.

  • How to get ADS installable

    Dear All,
    I am using SAP NetWeaver 7.1 SP5 J2EE trial version. Could any body conform that ADS comes with same package. I am not able to see ADS installed along with SAP server.
    From where I can get ADS installable file? I do not have market place user/pwd.
    As per this blog I could not get ADS installable without market place user/pwd.
    My struggles with the Adobe Document Services in WAS6.40
    Any suggestion would be highly appreciated.
    Thanks,
    Prakash

    I am using Netweaver 7.1 SP5 trial version. While opening server and looking for configuration in SAP Network Administrator I navigate to Adobe Document Services to install credentials I found:
    Adobe Document Services: Configuration
    There is no Adobe Document Services running on your system
    In my SAP server installation I did not see any directory 'AdobeDocumentServices' in directory 'global'.
    \usr\sap\J2E\SYS\global\AdobeDocumentServices\TrustManagerService\trust\credentials
    So I manually created directories in 'global'  \AdobeDocumentServices\TrustManagerService\trust\credentials and copies credentials file. restarted my server. even I am getting the same thing in SAP Network Administrator
    Adobe Document Services: Configuration
    There is no Adobe Document Services running on your system
    In document you provided its written for ADS Prerequisites are:
    Adobe document services are installed on your system.
    I am totally confused...somebody can help me!!!
    regards,
    Prakash

  • How to get "Windows Installer CleanUP" application.

    I use PC Vista Home Premium, and I use Adobe Acrobat Standard 8, till now it is working very well and nothing wrong. I would like to install an application of "Windows Installer CleanUP" to my PC for sometime in future I may need to use it, but I do not know how to get it to download and install the "Windows Installer CleanUP" into my PC Vista Home Premium.
    Please help and teach me. Thank you for your time and attentions.

    Since that is a MicroSoft product, you might have more luck at MicroSoft support site or forum dealing specifically with MicroSoft products.

  • How to get WAS Installation Number and  System Id?

    Anyone knows how to get Netweaver WAS Installation number and system id using java? I need these numbers to generate a unique key.
    Any help would be much appreciated. Thanks.

    Hi Maksim,
    I'm trying to do the same thing in webdynpro, but every time I get the 'ClassCastException'.
    InitialContext initialCtx = new InitialContext();
    MBeanServer mbs = (MBeanServer)initialCtx.lookup("jmx");
    <property name="ServicesReference" value="sap.com/jmx"/>
    <property name="LibrariesReference" value="sap.com/tc~jmx"/>
    the JNDI look up has this entry -
    + jmx
    + [Class Name] : com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain
    + [Object Value] : NON Serializable Object
    J2EE Engine is 6.40.
    could you please tell me what I'm missing.
    Thanks in advance,
    Rajiv.

  • How to change default installation directory sapinst_instdir TO other drive

    Hi,
    I am installing ECC 6.0 and have enough space in my disk for data files.
    I have alloted 20GB in C: drive which also comprise of Operating System.sapinst_ instdir directory grows more than 10GB and due to lack of space installation fails. How can i change th default sapinst_instdir directiory from C drive to other drive. can i use any software to change partition? ( with OS windows server 2003)
    I have also encountered an error at import phase of first job and after changing *.TSK file the installation proceeds. will this cause any serious problem.
    regards,
    Anand

    Hello,
    I understand from ur post is u want to create the instalaltion logs on another directory instaed of C:\ drive....if so u can follow the procedure as describe below..
    create temp directory in any other drive called D:\ drive...
    go in to that temp drive.....
    and fire the executable from that temp directory.....if u r executable in e:\ drive then....
    d:\temp>e:\installer\insatall.exe
    the above command creates all logs one by one in temp dorectory of D:\ drive instaed of c:\ drive..
    Thanks

  • How to get immediate parent directory name of a file

    Hi,
    I have file Object that points to a file. I want to know how I can get just the name of the parent immediate to the file For example, if the path of this file is, c:\\ProgramFiles\first\second\third\myFile.txt
    In the above, how can I obtain the last directory in which myFile.txt resides ?
    Thanks
    Sangeetha

    File myFile = new File("c:\\ProgramFiles\\first\\second\\third\\myFile.txt");
    File parentFile = myFile.getParentFile();
    String parentDirectory = parentFile.getName();
    System.out.println("Parent directory is "+parentDirectory);Here's the explanation...
    1) New File is created
    2) File.getParentFile returns the immediate parent of the current File, which happens to be a directory.
    3) File.getName() returns the name of the File, without the entire directory structure.
    Hope this helps :)
    Simon

  • Get domain root directory programmatically

    hello,
              There is any way to get the domain root directory path programmatically ??
              i.e : D:\bea\user_projects\domains\platformR1
              thanks

    John,
    OK. If you want to go the JMX route, have a look at the CurrentDirectory attribute of the ServerRuntime mbean. It would report your directory as this:
    C:\bea\user_projects\domains\myDomain\.
    Mike
    Weblogic/J2EE Security Blog: http://monduke.com

  • How to get CAN message periodicity programmatically?

    When I have messages with different periodicity in CAN data base file(.dbc), how do I programmatically know what is the periodicity of a given message? In the X-Net data base editor I can see the periodicity, but is there any way to get it in labview code?
    Also, some of the messages are to-be-transmitted and some are to-be-received. How can I separate these channels/messages  programmatically?
    Solved!
    Go to Solution.

    First the Automotive subforum maybe of more help if you don't find the answers you need here.
    Next I'd like to say I despise that conversion library and wish NI would take it off of this site.  It hasn't been updated in 5 years and it won't be updated again.  XNet has the same frame signal conversion functionality, and you don't need a XNet hardware to use it.  It also has bugs that I've reported to NI and their suggestion was to just use XNet so that is my suggestion to you.
    Now back to the original question.  No the older cheap NI-CAN devices do not have a hardware retransmit functionality.  You must call the write function every time you want to perform a write.  This usually means a while loop which just runs, and resends out all the frames you want ever N milliseconds.  You can do this easily with the elapsed timer VI or make your own timer.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to get Vista Installation Disk from Toshiba?

    I've been working with Microsoft support to resolve a security issue on my Satellite Pro A210, and have now been asked to use a Vista installation disk.
    Microsoft says that I am entitled to an installation disk from the original supplier of my kit - Toshiba. But one did not arrive with my laptop - only a recovery disk was supplied.
    How do I go about acquiring a Vista installation disk from Toshiba?
    Regards,
    Kevin C.

    Mores is right. Toshiba doesnt offer installations CD with operating system only. you will get recovery image.
    Recovery image definition:
    +Recovery Image is an exact copy of a computer's hard drive and contains the exact, byte-by-byte copy of a hard drive partition.+
    +The copy includes all the partition information, boot sectors, the file allocation table, operating system installation and different application software.+
    +Using Recovery installation CDs/DVDs, you can restore your system after heavy data loss caused by an operating system crash, virus attack or hardware failure complete.+
    +Recovery image installation procedure allows the user easy and fast system installation. Unfortunately it is not possible to restore only certain files from a disk image.+
    +Every recovery image is designed for one specific notebook model and it can not be used for any other notebook series.+

  • How to get RT IP Address Programmat​ically from Host?

    We have a laptop PC that plugs into a RT PXI to collect data and configure the software on it. How can we "dynamically" discover the IP of the RT so that the laptop can download (FTP) new configuration files to it without user intervention?
    I have discovered a seemingly "unsupported" ActiveX control called "NIMax Viewer" that lets you get miscellaneous information about all the things Max can see, including the RT systems. This control reduces the problem down to a few clicks from the user but its not the transparent solution we want. Unfortuneately, this control doesn't seem to allow programmactic navigation (the user still has to click on it to get it to change its selection).
    If anyone has a general soluti
    on to this problem, or more information about the NIMax Viewer ActiveX control, I appreciate hearing about it. Thanks.

    Hi VI Guy,
    In order to access your RT target you normally need to know its IP address. The example I linked earlier will help in situations where you need to connect to a specific RT target but for some reason do not know its IP address. This can happen if you configure your target to obtain an address from a DHCP server - which means that every time the controller boots it could potentially have a different address. When this happens, you could use this example to reestablish a communication with the RT engine.
    The reason the serial number is required is that we need to know which of all the RT targets found on your network is the one you are interested in. So yes, in order to connect to an RT target you do need to know either the static IP addr
    ess, or its serial number. You could figure out this serial number either from MAX or by looking at the sticker on the hardware.
    The example is provided as an exe because it is meant as a programmatic connection tool, specifically in a situation like the one described above (where a connection is lost). At this time we can't provide the source code that provides this functionality (so I guess calling it an example is a bit of a misnomer.)
    From your original post, I thought you were looking for a tool you could embed in your application that would find your controller. If this is not the case, please let me know. With your feedback, we can look at improving this utility or provide more effective ones.
    Regards,
    Dafna

Maybe you are looking for

  • Error message for Calendar in iCloud,

    A contact sent me an electronic meeting invitation.  When he has done it in the past, an event was automatically created in my calendar using the Calendar app.  I could then "accept" the invitation.  And, as one would expect, the event was entered in

  • Issues in running flash player activeX on 64 bit windows 2008 R2 server

    When the activeX acts up, users can not type anything into search boxes or use the keyboards in online game sites. From time to time, we have to re-install flash player again. We noticed that the FlashUtil64 activeX dll is somehow saved in c:\windows

  • Create attachment from url

    I want in Siebel to be able to create an attachment from a BI Publisher report. This report is generated via an url. In Siebel, if I click on the 'New File' button and then paste the url in the 'select file' field in the popup screen, the attachment

  • DAC not able to connect to Informatica services

    Hi All, I have an issue in connecting DAC with Informatica. In this scenario Informatica Server and DAC server in installed in Linux machine and Informatica Client and DAC client in Windows. I have given all configurations required. But DAC not able

  • Import button

    Is there a way to remove the "import" button on the home page for "My recently modified XXX ".