Finding java home directory during runtime

Hello dear all,
My problem is that i need to locate the java home directory dynamically during the runtime
of my application in order to use the /bin/jar tool.
Can you please provide me some help?
Thanks in advance,
Artemakis

The different OS's all have a facility (usually called environment variables) that contains OS parameters. If you place the location of the java home directory in one of the parameters it can be retrieved from within a Java program. An example entry would be JAVA_HOME=C:\Program Files\Java\jdk1.5.0_01 (in Windows)
The method to do this varies by version. Java 5 has a method in the System class, getenv(JAVA_HOME) that does this.
Earlier versions must pass the parameter name and value in at JVM startup, then the value can be retrieved by a java statement.
// This passes it in
java -DJAVA_HOME=C:\Program Files\Java\jdk1.5.0_01 <yourClass>
// This retrieves it
System.getProperty(JAVA_HOME);

Similar Messages

  • How To Find Oracle Home Directory Path...

    Hello,
    I am working on deployment of java web service on Oracle Application Server(LINUX) 10g, EBS - R12.
    I am working on other system and i want to deploy web service remotely on application server.
    And i am not getting the oracle home directory path. I want to find the home directory path remotely.
    so suggest me how to find out path of that.
    or weather i have to install jdevloper on server system and than i have to deploy it,
    or any other alternative way is available.
    Reply as soon as possible......

    Thanks for your reply.
    It's precisely the registry key which got tampered, and there's no ORACLE_HOME environmental variable(Or that too is tampered)
    Now,how to set it to one of the Oracle home directories?
    Regards,
    Bhagat
    !!!!!!!!!!!!!!!!!!!!

  • PHP 5.0.5 CLI: Am I able to set the Oracle home directory at runtime?

    I have two versions of Oracle installed on a SUN Solaris server:
    /opt/app/oracle/product/8.1.7
    /opt/app/oracle/product/9.2.0
    Am I able to set the Oracle home directory at runtime using PHP CLI?
    Thanks,

    The real answer is it depends how PHP loads Oracle. If the loading
    occurs when PHP starts and before your script executes then you will
    start to see problems. This could be as minor as missing error
    message text or it could be more subtle. In general set the Oracle
    environment before starting PHP.
    What about creating your scripts like:
    #!/bin/sh
    export ORACLE_HOME=/opt/app/oracle/product/9.2.0
    php ...-- cj

  • Java error message 'Can't find Java Home'

    While Installing an application, I can see the error popup window 'Can't find Java Home'. Why it occur the error message only most newer PC. Please advise me
    Thanks in Advance,
    Ponmuthu

    Well, hi again!
    My problem is not solved, when I tried to start Tomcat today it fails with the same message as earlier, namely
    C:\jakarta-tomcat-4.1.12-LE-jdk14\bin>catalina start
    The JAVA_HOME environment variable is not defined correctly
    This environment variable is needed to run this program
    Using CATALINA_BASE: C:\jakarta-tomcat-4.1.12-LE-jdk14
    Using CATALINA_HOME: C:\jakarta-tomcat-4.1.12-LE-jdk14
    Using CATALINA_TMPDIR: C:\jakarta-tomcat-4.1.12-LE-jdk14\temp
    Using JAVA_HOME: C:\j2sdk1.4.1_01
    Det g�r inte att hitta filen -Djava.endorsed.dirs=. (Could find the file -DJAVA.endorsed.dirs=...............
    And JAVA_HOME, CATALINA_HOME, TOMCAT_HOME is:
    C:\jakarta-tomcat-4.1.12-LE-jdk14\bin>echo %JAVA_HOME%
    C:\j2sdk1.4.1_01
    C:\jakarta-tomcat-4.1.12-LE-jdk14\bin>echo %TOMCAT_HOME%
    C:\jakarta-tomcat-4.1.12_LE-jdk14
    C:\jakarta-tomcat-4.1.12-LE-jdk14\bin>echo %CATALINA_HOME%
    C:\jakarta-tomcat-4.1.12-LE-jdk14
    Any more suggestions of why it's not working?

  • How do i find my home directory in order to clear it

    How do i find my <home directory> in order to clear it

    In Mac...the 2 home directories that have to be erased under the "Unintall Flash Player" on the Adobe website. its Step 9
    Date: Sat, 30 Nov 2013 11:49:55 -0800
    From: [email protected]
    To: [email protected]
    Subject: How do i find my &lt;home directory&gt; in order to clear it
        Re: How do i find my  in order to clear it
        created by Mike M in Installing Flash Player - View the full discussion
    Windows or Mac?
    and which home directory are you looking for?
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5887758#5887758
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5887758#5887758
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5887758#5887758. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Installing Flash Player at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Finding commits in plsql during runtime

    Hi,
    In any application, we will have many commit statements issued in many places. How can we find out as to where all commits have happened during runtime.
    Basically in our application, when am trying an operation, am getting the error ORA-01086: savepoint <save point name> never established.
    My guess is that there is a commit somewhere because of which system is not able to rollback to that save point.
    So I would like to find out where is commit is issued.
    Is there any way to find this.
    Thanks in Advance.
    Vijay

    Duplicate Post.
    Please mark this Answered and redirect to Finding commits in plsql

  • Java Home Directory

    Hi,
    I need to figure out where java is being installed on the system / not instsalled
    for e.g : C:\Program Files\Java\jdk1.6.0_16 or D:\Dev Tools\Java\jdk1.6.0_16 ...
    In short i want to search Java Home path @ runtime.
    Thanks,
    Dhaivat Parekh

    Hello ,
    Have you found an answer, as we are trying to do exactly the same?
    Many thanks,
    G.

  • Netbeans 6.7.1 & JavaFX Can't Find java.util.* at Runtime

    h1. Problem
    Netbeans 6.7.1 & JavaFX Can't Find the JRE classes (i.e. java.util.*) when the project is run (in Netbeans 6.7.1).
    h1. Reproduce
    Right Click Project_, then Run Project_
    init:
    deps-jar:
    C:\MyJavaFXProject\Source\Java\com\acme\Blah.java:4: cannot find symbol
    symbol : class ArrayDeque
    location: package java.util
    import java.util.ArrayDeque;h1. Workaround
    Add all the jar's found in JAVA_HOME. This is VERY BAD - because netbeans projects are no longer portable!
    h1. Does anyone else have this problem?
    Can you post a link if this problem is already on the forum or is in an Issue/Bug trackers somewhere please.
    Thanks for Reading.

    Thanks for the reply, evidently you are onto something!
    My NetBeans 6.7.1 JavaFX project is using the "JavaFX SDK on Java 1.6 (Default)" Platform.When I take a look inside this (using Manage Platforms) I can see that the following is in the list of platform classes:
    C:\Program Files\NetBeans 6.7.1\javafx2\javafx-sdk\lib\desktop\rt15.jarI'm assuming that rt15.jar is the java runtime @ version 1.5, and indeed this does NOT contain the Java 6 ArrayDeque ('_Array Deck_') class.
    ahhughes@machine-114 /cygdrive/c/Program Files/NetBeans 6.7.1/javafx2/javafx-sdk/lib/desktop
    $ jar -tvf rt15.jar | grep "ArrayDeque"
    ahhughes@machine-114 /cygdrive/c/Program Files/NetBeans 6.7.1/javafx2/javafx-sdk/lib/desktop
    $So my question is, why? If this is the "_NetBeans JavaFX SDK on Java 1.6 (Default)_", then why is it using the 1.5 runtime? It's obviously using 1.6 at compile time... this just seems busted to me.

  • Help with Finder and Home Directory

    I know this sounds daft but I wish to create a new folder under the home folder on my system but the house icon within finder has a lock on it. I have tried applying root access to this account and accessing finder again but to no avail. Therefore I assume I need to do something else to be able achieve this?

    It's supposed to have a lock on it, requiring an admin user password to unlock. There's no reason to use root access. Click on the lock, enter your admin password, and set the settings as: user w/R&W, staff or admin w/R only, and everyone w/read only. That should allow you to create a folder within that account.

  • How do I move my home directory to another disk?

    I want to find out the "standard procedure" for moving my home directory to another disk.  My current system disk is getting quite full, so I have purchased additional storage.  The issues I am concerned about are the following:
    Preserving the file permissions
    I have used rsync and ditto commands to copy the file.  Does rsync preserve the permissions like the ditto command?
    Updating the System to use the new home directory
    I have used the Ctl-Click on the accounts control panel to update the location of the home directories.  Do applications use "~<username>" or /Users/<username> to find the home directory of the user (obviously this is limited to Apple Controlled software).
    Understanding the /Users and /home directories
    Since Apple is no longer using netinfo, I wanted to get a better understanding how these directories are set up.  Is the /home directory exclusively for network mounted home directories.
    Please let me know if you have any questions.

    I disagree with Linc Davis on whether to move the home folder, But I think you are going about it the wrong way. 
    Having a Boot drive with only System, Library, Applications, and the hidden unix directories including Paging/Swap on it is one of the best ways to speed up routine disk Access for all your other files. The system keeps "snacking" away loading and reloading bits and pieces of System and Applications as you work, and that System activity slows "regular" disk access way down by moving the drive heads away from the files you are processing.
    Giving System files their own drive speeds up everything.
    Here are two good recipes and discussions about how and why to do this, and how to make it happen without a single line of Terminal code:
    http://chris.pirillo.com/how-to-move-the-home-folder-in-os-x-and-why/
    http://jcsenterprises.com/Japamacs_Page/Blog/00E03B83-1ADA-406E-A940-396D39F598E A.html

  • How do I change home directory name?

    In FINDER, the home directory name is from an old employee. How can I change it?

    Log out and then into a different user account, or create one from System Preferences. If so desired, control-click the account in the Accounts or Users & Groups pane of System Preferences, choose Advanced Options, and change the name and home properties; if the computer happens to be running Mac OS X 10.4, the instructions are significantly different.
    (71132)

  • Home directory has disappeared - help!

    I have just logged on to my MacBook and received a message to say that it can't find my home directory - it's just not there in the Users folder.
    I am the main user (administrator). There is one other user of the computer who has an account and her folder is there, as is 'Shared' and another folder with my user ID, but with a '1' appended to the end.
    What has happened - any help gratefully received...
    ~~
    simon

    My 2 cents, most OS X gurus will tell you not to run as an administrator. Keep one or 2 admin users on tap, one for installing/etc. and one as a "control." Run day-to-day ops as a standard user.
    This is better security and keeps you from making mistakes without entering a password.
    You can do this by:
    1)Backing up! Always do this before making changes to your system.
    2)Create 1 or 2 new admin accounts. I would make 2 new admin accounts. Name one "Control" and the other something like "Owner."
    3)Log into "Owner" and change your old account to a standard user.
    4)I would verify permissions at least twice after you do this to get any bugs out.
    5)Restart, log in as your old (now standard) account.
    Keep the "Owner" password handy for when you need to install/make changes/etc to your system.
    Don't use "Control" except for just that, to see if a problem affects that account as well as other accounts.

  • 10.5 clients won't login/mount home directory

    Hello all,
    I am having some issues with 10.5.8 clients logging in network users.  At our school, we have a "magic triangle" setup -- Mac and PC clients, an Active Directory for user authentication (a Win 2k3 server DC I believe), and an Open Directory server (running 10.7.5 OS X Server) for Workgroup Managment and software updates.  Along with this, there is a Linux NAS box that acts as the file server hosting the user's home directories.
    I have a few test student accounts that I have set up exactly the same way that normal student accounts are added to AD.  Users have complained that these 10.5.8 clients will not let any students log on, as I have verified with my test student accounts.  When logging in, an error comes up that says "Logging into the account failed because an error occurred".  In secure.log I get a "smb_mount: syserror = Broken pipe" line along with
    ERROR | -[HomeDirMounter mountNetworkHomeWithURL:attributes:dirPath:username:] | PremountHomeDirectoryWithAuthentication( url=smb://fileserver.domain.org/username, homedir=/Network/Servers/fileserver.domain.org/username, name=username ) returned 32
    When I turn off "Create Mobile Account at Login", the user can log in just fine, which obviously leads me to believe that there is an issue with mounting the samba share for the user's home directory during the HomeSync.
    I know the client can resolve the file server's hostname by nslookup, so I don't think DNS is the issue.  But I'm all out of ideas after looking everywhere online, and am hoping someone can assist me with this.  I'm just a computer technician and not a network sys admin by any means, but I know a good enough amount to try to troubleshoot this.  Even my network manager is stumped, and his answer is to upgrade the client to 10.6, resolving that the issue is with 10.5. I want to try to solve this issue rather than having to re-image all the 10.5 machines.
    Obviously school is out for the weekend, so I won't be back for a couple days to work on the issue if anyone does respond in the next couple days.
    Thanks in advance!
    -Brandon

    Hi Brandon, certainly no expert at this, but let me trow this out at you...
    Found a work-around. This command adds a delay, in this case 45 seconds, before displaying the Login Window.
    defaults write /Library/Preferences/com.apple.loginwindow StartupDelay -int 45
    If the Login Window UI detects that the network servers are available when it starts, it will skip the delay, also if network servers become available before the delay expires, the Login Window UI cancels the delay and displays.
    Kent

  • Re: Lion Update 10.7.2 Home Directory on another volume

    Hi all,
    Fought this for a few days.
    Machine MacMini 2007 with 500GB Hard drive installed.
    On OS X 10.6.x and OS X 10.7.1.x I had moved my home directory to another volume, as my Home directory was initially as big, and is now bigger than my boot drive.  Installed 10.7.2 upgrade and after macine rebooted told me it could not find my home directory. 
    1.  External volumes were not showing on left panel of Finder or on desktop as was in previous version.
          Problem:  Obviously 10.7.2  did not preserve previous preferences and machine setup.  Did not see that notice in release notes.
          Solution:  went into finder preferences and selected options to set those. 
    2.  Ran Applications/Utilities/DiskUtility on all Volumes. 
         Solution:  some drives had some errors, but everything repaired just fine.
    3.  Opened Terminal and checked external volume with my home directory on it /Volumes/Users/<HomeDirectoryName>, all files seemed to be there and intact
    4.  Opened Settings/Users & Accounts, right clicked on login, Home directory was set to the correct location.
    5.  In Terminal performed the following steps, and verified directories:
             >cd /
             >ls -la
             > cd Volumes
             > ls -la
             > cd Users
             >ls -la
           Directory showed Login Name symbolically linked to location on external drive
            Problem:   No home directory files (i.e. Documents, Pictures, Movies were all empty)  Dock showed up as if new install, no preferences remembered
    6.  Called Apple support line, finally got senior technician on line, and had to argue a bit with the technician that I wanted to have my Home Directory on another volume.  After we settled on that fact, and review of previous steps, he had me change the Home directory setting which we did several times.  After changing /Volume/Users/<LoginName> a couple of times and getting Users1 and Users2 directories created he convinced me that the problem was using /Volumes/Users/ anything for my external volume.  We then created a new partition by splitting the drive, and I proceeded to copy to a new partition called MyUsers.  Left apple support while approximately 700 GB were copied to new partition.
    7.  Let computer cook until next morning.  Tried setting home directory in Users Accounts/Login/Advanced to /Volumes/MyUser/<LoginName> still no joy!
    8.  Took Shower -- always get best ideas in shower!  went back re-read MacWorld Articales on moving Home directory, and TUAW article.
    9.  Determined the problem.
    10. Problem:  OSX 10.7.2 creates a new home directory on the boot drive, even if you symbolically link to another one.  Thus the Users1 and Users2 directories on the boot drive root directory.  Settings/User Accounts/<login>/Advanced does not do this properly
          Solution:  Delete the boot drive login directory, no matter what it points to and symbolically link to external directory.
              Open Terminal Session:
                 >cd /
                 >sudo rm -rf <LoginName>
                 >sudo ln -s /Volumes/<VolumeName>/<LoginName> <LoginNme>
                Restart computer
                Note:  VolumeName =Users works just fine.
    If Engineering will check to see if an existing directory exists for the Home directory and set it up, then the problem would not have happened.
    Hope this helps Engineering and others with this problem.

    I tried something a bit different that worked (so far). I always have a second Admin account that has its home directory still on the main Mac HD. I logged into that account and opened system prefs. Then I found my account and right clicked on it to get the "Advanced options." I reset the account's home folder (which said it was on the external drive) to the internal Mac HD.
    Logged out of Admin account and back into my account, which showed as a new user account. Logged out and back in as Admin, then back to system prefs and "Advanced options" for my real account. Changed the path to my home folder on the external drive. Logged out of Admin, back to my account and it was fixed.
    Hope this helps anyone having the same problem.

  • "Home Directory" full in mail

    I can't use my mail as I keep getting this message:
    "Mail cannot update your mailboxes because your home directory is full. You must free up space in your home folder before using mail. Delete unneeded documents or move documents to another volume."
    I can't find this 'home directory' and have no issues using mail on my other mac which is linked to the same pop account.

    Hi surepure,
    It sounds like you are using Filevault.
    Filevault- "There isn't enough space on your hard disk..." alert ...
    http://support.apple.com/kb/TS1974
    Mac OS X 10.3, 10.4: FileVault - How to verify or repair a home directory image ...
    http://support.apple.com/kb/HT2631?viewlocale=en_US

Maybe you are looking for

  • Adding new RAM to Mac Pro

    I just got my new Mac Pro. It comes with (2) 1G sticks of DDR2 RAM. I bought (4) 2G sticks of DDR2 RAM from OWC to put in it. Can I just add my 2G sticks and keep the 1G sticks in, or do they all have to be the same size? I spoke with 2 different App

  • Search Anomalies Using Oracle Text

    Hi, I get inconsistent results returned between the Basic and Advanced Searches. For example if I do a Basic Search on 'bats' then I get 51 hits returned. If I do a similar search for 'bats' using Advanced Search (Contains All/Any across a single Con

  • Know about page parameter

    Hi, I want is there any page parameter portlet if it is then where it is in oracle portal

  • New to Business Graphics in WD ABAP

    Hi all, I am new to Business Graphics in WD ABAP. I have already go through the WDR_TEST_EVETS. But I don't get it clearly. Is there any other document or any earlier thread to understand BG. Please suggst. Thanks Sanket sethi

  • Current Status of the iOS4 issue(s)?

    Luckily I caught wind of the iOS4 issues with ipods, and still have my 2G 8Gb in 3.1.3 version. Is it safe to upgrade yet? I've read all these horror stories, has it been resolved? Should I stick with what I have? I heard downgrading was possible but