RCP, Environment Variables, OS X, Info.plist and LSEnvironment

I've got a somewhat challenging problem here.
I've got an RCP application that relies upon some shared dynamic libraries which might not be in standard locations (as this is OS X and they are user installed).
One of the things we need to configure is DYLD_LIBRARY_PATH in order for the shared libraries be discovered. The problem here is OS X doesn't have a simple way to set environment variables that applications launched from the Finder can "see".
One of the thing that I've found, but not had any success with, is to dynamically modify the RCP's Info.plist to have an additional key LSEnvironment whose value is a dictionary to set environment variables only visible to that application - okay this seems ideal for me. But it's not working.
I also found that I could use launchctl setenv to set a user global Environment variable, however it's not persistent across launches, and each time I set, I must restart the app. I really need this persistent.
Does anyone have any solution for setting Environment variables that are visible from the RCP app (and it's children) that works in OS X without having to launch the RCP app from a terminal?
Thanks in advance!

Brian de Alwis wrote on Wed, 05 August 2015 19:54Sounds like you want to use System.loadLibrary() with absolute paths?
That doesn't quite work, as we aren't using JNI. Unfortunately the use-case details get pretty complicated - so I omitted in an effort to make it simpler to understand the problem.
Basically we have built an IDE that uses the Prolog interpreter, XSB. XSB natively connects to MySQL using the shared MySQL libs. Unfortunately on OS X, MySQL can get installed into possibly one of many locations, and it certainly doesn't install it's libs in /usr/local/lib or /usr/lib. We access XSB via a Java library called Interprolog, which I believe, is just a pipe interface to the command line shell - hence when the Interprolog engine object is instantiated, it fires up a shell process for XSB - which needs to locate those MySQL libraries. Hence, DYLD_LIBRARY_PATH needs to be set to have the path for /usr/local/mysql/lib (or wherever the user installed it) defined in the parent process in order for Interprolog's sub-process to pick up the environment variable.
Right now there are only 2 reliables ways I have found to get this to work.
1. Launch Terminal, export the environment variable. Then launch our RCP app from the Terminal. - cumbersome and unintuitive; bad user experience.
2. Launch Terminal, use `launchctl setenv DYLD_LIBRARY_PATH /usr/local/mysql/lib`. And then one can lacuna our RCP app using Finder. - problem is that DYLD_LIBRARY_PATH is now global to the environment and will not persist between reboots.
I've tried added the LSEnvironment dictionary to the Info.plist within the RCP application, but that just doesn't seem to work - and I'm not sure if that is because the OS X eclipse launcher doesn't propagate the environment forward or what. For the time being I have a way for the user to click a button which runs launchctl setenv and then prompts the user to exit the app, and then launch again from finder [IWorkbench.restart() doesn't work because new process is a child of the current] - which works but is undesirable workflow as it doesn't persist across a login/reboot.
My next step is to try what is outlined here: http://stackoverflow.com/questions/829749/launch-mac-eclipse-with-environment-variables-set
However it feels even more sketchy than just modifying the Info.plist to contain the right environment variables.

Similar Messages

  • I've changed Info.plist and quicktime crashes

    Hi all,
    I've tried to enable mkv recognition and changed Info.plist, then I restored it to default state, but Quicktime Player is now crashing all the times. Any suggestions how can I reinstall it or solve the problem? Thanks!
    Process:         QuickTime Player [514]
    Path:            /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player
    Identifier:      com.apple.QuickTimePlayerX
    Version:         10.3 (727.1)
    Build Info:      QuickTimePlayerX-727001000000000~1
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [158]
    Responsible:     QuickTime Player [514]
    User ID:         501
    Date/Time:       2014-01-14 16:58:39.254 +0400
    OS Version:      Mac OS X 10.9.1 (13B42)
    Report Version:  11
    Anonymous UUID:  5B646373-70AB-9F8C-6EDA-7E91B61DF5CD
    Crashed Thread:  0  Dispatch queue: com.apple.main-thread
    Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
    Exception Codes: 0x0000000000000001, 0x0000000000000000
    Application Specific Information:
    Sandbox creation failed: Unable to get bundle identifier for container ID com.apple.QuickTimePlayerX: (null)
    Application Specific Signatures:
    Unable to get bundle identifier for container ID com.apple.QuickTimePlayerX: (null)

    As you just found out the hard way, it's always a good idea to have a backup, especially before you start messing with system files. Don't feel too bad, everyone seems to learn the hard way. You can try this, though if it were me I'd back up what I had first just in case.
    http://support.apple.com/kb/dl923

  • Edited Bootcamp's info.plist and now Bootcamp won't open?

    Here is the error report I get. Really want to get this fixed, so any help would be greatly appreciated.
    Process:         Boot Camp Assistant [285]
    Path:            /Applications/Utilities/Boot Camp Assistant.app/Contents/MacOS/Boot Camp Assistant
    Identifier:      com.apple.bootcampassistant
    Version:         ???
    Build Info:      BootCampAssistant-5700000000000000~6
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [129]
    Responsible:     Boot Camp Assistant [285]
    User ID:         501
    Date/Time:       2014-06-22 10:09:56.562 -0700
    OS Version:      Mac OS X 10.9.2 (13C64)
    Report Version:  11
    Anonymous UUID:  7E43C5D1-D2C4-D1E3-F9D7-B8667AAE4BBA
    Crashed Thread:  0
    Exception Type:  EXC_CRASH (Code Signature Invalid)
    Exception Codes: 0x0000000000000000, 0x0000000000000000
    VM Regions Near 0x7fff799540a8 (cr2):
        __LINKEDIT             00007fff64f32000-00007fff64f46000 [   80K] r--/rwx SM=COW  /usr/lib/dyld
    --> Submap                 00007fff70000000-00007fff80000000 [256.0M] r--/rwx SM=PRV  process-only VM submap
        unused shlib __DATA    00007fff797a3000-00007fff7bfbd000 [ 40.1M] rw-/rw- SM=COW  system shared lib __DATA not used by this process
    Thread 0 Crashed:
    0   dyld                           0x00007fff64ec0028 _dyld_start + 0
    Thread 0 crashed with X86 Thread State (64-bit):
      rax: 0x000000000000000d  rbx: 0x0000000000000000  rcx: 0x0000000000000000  rdx: 0x0000000000000000
      rdi: 0x0000000000000000  rsi: 0x0000000000000000  rbp: 0x0000000000000000  rsp: 0x00007fff53ed7d08
       r8: 0x0000000000000000   r9: 0x0000000000000000  r10: 0x0000000000000000  r11: 0x0000000000000000
      r12: 0x0000000000000000  r13: 0x0000000000000000  r14: 0x0000000000000000  r15: 0x0000000000000000
      rip: 0x00007fff64ec0028  rfl: 0x0000000000000201  cr2: 0x00007fff799540a8
    Logical CPU:     0
    Error Code:      0x020000f4
    Trap Number:     133
    Binary Images:
        0x7fff64ebf000 -     0x7fff64ef2817  dyld (???) <2B17750C-ED1B-3060-B64E-21897D08B28B> /usr/lib/dyld
    External Modification Summary:
      Calls made by other processes targeting this process:
        task_for_pid: 0
        thread_create: 0
        thread_set_state: 0
      Calls made by this process:
        task_for_pid: 0
        thread_create: 0
        thread_set_state: 0
      Calls made by all processes on this machine:
        task_for_pid: 159
        thread_create: 0
        thread_set_state: 0
    VM Region Summary:
    ReadOnly portion of Libraries: Total=288K resident=268K(93%) swapped_out_or_unallocated=20K(7%)
    Writable regions: Total=8444K written=0K(0%) resident=12K(0%) swapped_out=0K(0%) unallocated=8432K(100%)
    REGION TYPE                      VIRTUAL
    ===========                      =======
    STACK GUARD                        56.0M
    Stack                              8192K
    VM_ALLOCATE                           8K
    VM_ALLOCATE (reserved)                4K        reserved VM address space (unallocated)
    __DATA                              252K
    __LINKEDIT                           80K
    __TEXT                              208K
    mapped file                         232K
    shared memory                         4K
    ===========                      =======
    TOTAL                              64.8M
    TOTAL, minus reserved VM space     64.8M
    Model: MacBookPro5,5, BootROM MBP55.00AC.B03, 2 processors, Intel Core 2 Duo, 2.26 GHz, 8 GB, SMC 1.47f2
    Graphics: NVIDIA GeForce 9400M, NVIDIA GeForce 9400M, PCI, 256 MB
    Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1067 MHz, 0x859B, 0x435434473353313036374D2E4D3136464B44
    Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1067 MHz, 0x859B, 0x435434473353313036374D2E4D3136464B44
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8D), Broadcom BCM43xx 1.0 (5.106.98.100.22)
    Bluetooth: Version 4.2.3f10 13477, 3 services, 23 devices, 1 incoming serial ports
    Network Service: Wi-Fi, AirPort, en1
    Serial ATA Device: TOSHIBA MQ01ABD100, 1 TB
    Serial ATA Device: HL-DT-ST DVDRW  GS23N
    USB Device: Built-in iSight
    USB Device: Internal Memory Card Reader
    USB Device: Apple Internal Keyboard / Trackpad
    USB Device: IR Receiver
    USB Device: BRCM2046 Hub
    USB Device: Bluetooth USB Host Controller
    Thunderbolt Bus:

    Was Bootcamp code signed after info.plist was updated?
    Please see Enable Bootcamp to install from usb for OSX 10.9**WORKS**

  • Environment variables /etc/skel/local.profile and /etc/skel/.profile

    Hi
    I have a problem to provide the working environment for ALL THE USERS :/ with all the files in this directory:
    */etc/skel/*
    In Oracle Documentation says: You can use these files ( */etc/skel/local.profile* ) as a starting point and then modify them to create a standard set of files
    that provide the work environment common to all users. Defines the user's environment at login.
    I edit the file */etc/skel/.profile* for put the JAVA_HOME variable for all the users of this way
    nano /etc/skel/.profile
    export JAVA_HOME=/usr/bin/java *#I added this variable*
    export PATH=/usr/bin:/usr/sbin
    if [ -f /usr/bin/less ]; then
    export PAGER="/usr/bin/less -ins"
    elif [ -f /usr/bin/more ]; then
    export PAGER="/usr/bin/more -s"
    fi
    case ${SHELL} in
    *bash)
    typeset +x PS1="\u@\h:\w\\$ "
    esac
    Later I check the parameters to add the user
    useradd -D
    group=staff,10 project=default,3 basedir=/export/home
    skel=/etc/skel shell=/usr/bin/bash inactive=0
    expire= auths= profiles= roles= limitpriv=
    defaultpriv= lock_after_retries=
    adduser -m testuser
    passwd testuser
    I log on as testuser and check if the variable JAVA_HOME is available, but no.
    Why it can not see that variable as available? THAN YOU FOR YOUR HELP

    Try local.profile instead of .profile
    If there is one already there then rename it first.
    alan

  • Library paths and environment variables

    Hello,
    I am using 10g AS 9.0.4 on a Unix system.
    I am trying to convert an old JSP web application to work with 10g. It is not an EAR/WAR file so I am manually trying to set it up under the "default-web-app" folder. It uses a number of java class files which currently reside in $J2EE_HOME/default-web-app/WEB-INF/classes/mystuff.
    These class files require access to a number of libraries. I foolishly believed that they would be accessible if I were to place them in the $J2EE_HOME/default-web-app/WEB-INF/lib folder, but that did not work.
    I read that OC4J uses a "catch all" lib directory at $J2EE_HOME/applib. I copied the library files there and they still did not work.
    Frustrated, I tried to print out the environment variables for the server - only to find that this function is not supported.
    I managed to print out the library path by creating a Java class files which returns the following as a string:
    System.getProperty("java.library.path");
    This (when called from a JSP) prints a number of different library paths, none of which match those found listed in the $J2EE_HOME/config/application.xml file. I placed the library files in one of the paths listed by the "java.library.path" and it worked!
    3 questions:
    1. How do you print the server's environment variables using a JSP? This strikes me as a very useful function for sorting out library and path issues. Do a search on Google for "print environment variables OC4J" or something similar and there are no useful pages suggesting how this can be done.
    2. Why are the default library paths different on the server than to those specified in application.xml?
    3. How do I change the LD_LIBRARY_PATH (or any environment variable for that matter)? I have tried adding the following line to $ORACLE_HOME/Apache/Jserv/etc/jserv.properties without success:
    wrapper.env=LD_LIBRARY_PATH=/my/custom/library/path
    Any help you can offer would be most appreciated.

    >
    Thanks very much for a such a comprehensive response
    - it has helped answer a lot of questions, especially
    being able to print out the system properties. That
    will be really useful!
    No worries at all Rob.
    The main hurdle is that the libraries are indeed
    native (*.so) libraries. I hadn't considered that
    until you pointed it out in your message. Can I
    assume, then, that $J2EE_HOME/applib and
    $J2EE_HOME/default-web-app/WEB-INF/lib are only
    designed to handle Java's .JAR librares? That would
    explain why placing the native libraries in there
    didn't work, but is there a way of getting such
    native libraries recognised and bundled up in a
    WAR/EAR file?
    Yep, that's it.
    Our proprietary applib and the servlet specs web-inf/lib are only dealing with Java archives.
    The J2EE specs don't cover how to deal with native libs like this.
    Now I've NEVER EVER tried it, but it's worth a shot of at least trying -- for simplified packaging purposes, what you may be able to do is to distribute the .so's within the web-inf/lib -- and then just set that directory (where's its realized on the server after the app is deployed) to be referenced witihn the LD_LIBRARY_PATH. I'd expect our deployment manager will just ignore files it doesn't know about, so arguably you should be able to at least distribute them with the standard archive.
    You'll need to specifically set the LD_LIBRARY_PATH as a separate task outside of the deployment operation though.
    >
    This is where things get a bit weird, and is partly
    my fault during the installation of 10g AS.
    We already had an existing installation of Oracle 10g
    Database (10.1.0) at $ORACLE_HOME under the user
    "oracle". I logged in as the user "oracle" to install
    the Application Server into a different location (In
    this case, "$ORACLE_HOME/../ias10g_9.0.4" - let's
    call this $IAS_HOME). So there is no separate user
    account for Oracle Database and Application Server
    (and hence no separate $LD_LIBRARY_PATH).
    If I log into UNIX as the user "oracle" and echo the
    LD_LIBRARY_PATH, I get the following directories:
    $ORACLE_HOME/lib
    /usr/openv/netbackup/bin
    /usr/dt/lib
    /usr/lib
    I use this user to do "opmnctl stopall" and "opmnctl
    startall". If I then print out the library path from
    a JSP using
    "System.getProperty("java.library.path");", I get the
    following paths:
    $IAS_HOME/jdk/jre/lib/sparc/server
    $IAS_HOME/jdk/jre/lib/sparc
    $IAS_HOME/jdk/jre/../lib/sparc
    $IAS_HOME/opmn/lib
    $IAS_HOME/lib
    $IAS_HOME/usr/lib
    Which is totally different to those listed by
    $LD_LIBRARY_PATH at the command line, which means
    they must be coming from somewhere else.
    It gets worse - my application is trying to call a
    native library that is only present in the
    $ORACLE_HOME/lib32 directory (libclntsh.so.10.1), so
    unless I can include this path in the
    "java.library.path" on the Applicaiton Server, then
    my program will not work.
    So, how do I change the "java.library.path" when the
    values aren't coming from $LD_LIBRARY_PATH in the
    first place?
    The utility $IAS_HOME/opmn/bin/opmnctl is actually a shell script.
    It has this section which sets the LD_LIBRARY_PATH:
    if [ -z "$LD_LIBRARY_PATH" ]
    then
    LD_LIBRARY_PATH=$ORACLE_HOME/opmn/lib:$ORACLE_HOME/lib ; export LD_LIBRARY_PATH
    else LD_LIBRARY_PATH=$ORACLE_HOME/opmn/lib:$ORACLE_HOME/lib:${LD_LIBRARY_PATH} ; export LD_LIBRARY_PATH
    fi
    So if you have an existing LD_LIBRARY_PATH env var set, it should just be putting its paths onto the front of it.
    What you could try as a quick test is to edit the opmnctl script (after taking a backup of course) and either appending the path you need to it, or just add some debug statements to output the LD_LIBRARY_PATH value it ends up setting so you can try and work out what's causing it.
    I expect these other entries:
    $IAS_HOME/jdk/jre/lib/sparc/server
    $IAS_HOME/jdk/jre/lib/sparc
    $IAS_HOME/jdk/jre/../lib/sparc
    are coming from the JRE when it is launched, in probably a similar manner to our opmn entries.
    I really appreciate your help, and I bet if anyone
    can answer these questions, you can! ;-)
    You're very welcome.
    cheers
    -steve-

  • Macbook Pro Hard drive partition and Bootcamp Info.plist

    Okays, so i was planning on installing windows through USB bootcamp as my CD is broken. I tried editing the Info.Plist and i managed to stuff it up and lost original now it doesnt work, how do i redownload my original one.
    THEN i tried to partition the hard drive with disk utility, i accidentally didnt resize each partition and force quit the app and now my hard drive shows 249.56 GB FULL instead of 129.45 full, what do i do to fix my hard drive. in the "about this mac" it shows half my hard drive used as "Other". Please help
    Its a Macbook pro 2010 13inch
    running 10.9 Maverick

    Hi Michele,
    Sounds like a corrupted partition map. Can you run the Bootcamp Setup Assistant again to restore the drive to a single volume? Otherwise, I'd backup the OS X side and then re-partition the drive and start from scratch, then restore your backup so at least you'll be back up and operational on the OS X relatively quickly.

  • System PATH environment variable issue when user log off and log in or switch from admin to non-admin account

    Hi,
    Problem Description:
    After installing my new product version, when user does log-off and log in again into admin account
    or switch from admin account to non-admin account, PATH environment variable shows incorrect path of my product (previous product version’s path) using command prompt.
    It seems windows refresh issue during session changes (log off and log in / switch from Admin to
    Non-admin account).
    Why PATH environment variable is not refresh immediately after log off and log in again or Switch
    from admin to non-admin mode?. 
    Please see my thread for more details http://social.msdn.microsoft.com/Forums/vstudio/en-US/445ab42c-bdff-405a-8d53-558e1b6c7d34/path-environment-variable-issue-when-user-logoff-and-login-or-switch-from-admin-to-nonadmin?forum=windowsgeneraldevelopmentissues
    Also submitted bug for this in connect.microsoft.com portal.In that it has lots of information
    like problem statement, Reproduction steps and Expected Results.
    Bug ID: 871782
    Could you please any body help me for this?. your support will be appreciated.
    Thanks,
    Marichamy

    Why PATH environment variable is not refresh immediately after log off and log in again or Switch
    from admin to non-admin mode?. 
    I wouldn't have any expectation of what you are doing to work the way you expect.  E.g. why is the %ABC% being replaced at all?  There is some help about this ambiguous scenario in the cmd help...
    /V:ON Enable delayed environment variable expansion using ! as the
    delimiter. For example, /V:ON would allow !var! to expand the
    variable var at execution time. The var syntax expands variables
    at input time, which is quite a different thing when inside of a FOR
    loop.
    /V:OFF Disable delayed environment expansion.
    So, what's the setting for the /V:  switch that your users would be using?  Perhaps you should be using the ! instead of the % for your ABC variable?
    Oh.  There's more below where I found that...
    Delayed environment variable expansion is NOT enabled by default. You
    can enable or disable delayed environment variable expansion for a
    particular invocation of CMD.EXE with the /V:ON or /V:OFF switch. You
    can enable or disable delayed expansion for all invocations of CMD.EXE on a
    machine and/or user logon session by setting either or both of the
    following REG_DWORD values in the registry using REGEDIT.EXE:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion
    and/or
    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion
    to either 0x1 or 0x0. The user specific setting takes precedence over
    the machine setting. The command line switches take precedence over the
    registry settings.
    In a batch file the SETLOCAL ENABLEDELAYEDEXPANSION or DISABLEDELAYEDEXPANSION
    arguments takes precedence over the /V:ON or /V:OFF switch. See SETLOCAL /?
    for details.
    If delayed environment variable expansion is enabled, then the exclamation
    character can be used to substitute the value of an environment variable
    at execution time.
     So, I guess the essence of your "bug" will boil down to whether you
    need the feature to get the result you want and the
    truth of that first sentence but it certainly looks like a "can of worms" to me.   ; )
    HTH
    Robert Aldwinckle

  • Setting JAVA_HOME environment variable?

    Sorry for such a trivial question, but in Windows 2000 Server with Microsoft Visual J++ 6 and the JRK 1.1.8, can somebody tell me what the environment variables should be so that I can use this jdk? If not can you tell me what your environment variable JAVA_HOME points to?
    And one last question if it's not too much to ask. Can you tell me the NNTP server address for SUN so that I can go to the newsgroups in my News reader rather than over the web?
    Thanks.
    George Hester

    Thanks. I have a problem though. I installed the jdk 1.1.8 because I heard that was the last one supported using Visual J++. Hence I have a C:\jdk1.1.8. This folder has no JRE subfolder so I am stuck at what you said the Classpath should contain as the path\folder you say it should be does not exist.
    I have a folder C:\Program Files\JavaSoft\JRE\1.3.1 which has the lib folder containing rt.jar.
    So as you can see I'm sort of in a quandry.
    If I make JAVA_HOME as you say then it does not contain the JRE. If I make JAVA_HOME C:\Program Files\JavaSoft so that your suggestion for Classpath is correct that folder does not contain the jrk and it seems that I will not be using it.
    Any suggestions how to set this up so that it's right?
    George Hester

  • How to get system Environment variable?

    How to get system Environment variable without using jni?
    just like "JAVA_HOME" or "PATH"...
    Any reply is help to me!! :-)

    Thx for your reply...
    I get it!!!
    Read environment variables from an application
    Start the JVM with the "-D" switch to pass properties to the application and read them with the System.getProperty() method. SET myvar=Hello world
    SET myothervar=nothing
    java -Dmyvar="%myvar%" -Dmyothervar="%myothervar%" myClass
    then in myClass String myvar = System.getProperty("myvar");
    String myothervar = System.getProperty("myothervar");
    This is useful when using a JAVA program as a CGI.
    (DOS bat file acting as a CGI) java -DREQUEST_METHOD="%REQUEST_METHOD%"
    -DQUERY_STRING="%QUERY_STRING%"
    javaCGI
    If you don't know in advance, the name of the variable to be passed to the JVM, then there is no 100% Java way to retrieve them.
    NOTE: JDK1.5 provides a way to achieve this, see this HowTo.
    One approach (not the easiest one), is to use a JNI call to fetch the variables, see this HowTo.
    A more low-tech way, is to launch the appropriate call to the operating system and capture the output. The following snippet puts all environment variables in a Properties class and display the value the TEMP variable. import java.io.*;
    import java.util.*;
    public class ReadEnv {
    public static Properties getEnvVars() throws Throwable {
    Process p = null;
    Properties envVars = new Properties();
    Runtime r = Runtime.getRuntime();
    String OS = System.getProperty("os.name").toLowerCase();
    // System.out.println(OS);
    if (OS.indexOf("windows 9") > -1) {
    p = r.exec( "command.com /c set" );
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1 )
    || (OS.indexOf("windows xp") > -1) ) {
    // thanks to JuanFran for the xp fix!
    p = r.exec( "cmd.exe /c set" );
    else {
    // our last hope, we assume Unix (thanks to H. Ware for the fix)
    p = r.exec( "env" );
    BufferedReader br = new BufferedReader
    ( new InputStreamReader( p.getInputStream() ) );
    String line;
    while( (line = br.readLine()) != null ) {
    int idx = line.indexOf( '=' );
    String key = line.substring( 0, idx );
    String value = line.substring( idx+1 );
    envVars.setProperty( key, value );
    // System.out.println( key + " = " + value );
    return envVars;
    public static void main(String args[]) {
    try {
    Properties p = ReadEnv.getEnvVars();
    System.out.println("the current value of TEMP is : " +
    p.getProperty("TEMP"));
    catch (Throwable e) {
    e.printStackTrace();
    Thanks to W.Rijnders for the W2K fix.
    An update from Van Ly :
    I found that, on Windows 2003 server, the property value for "os.name" is actually "windows 2003." So either that has to be added to the bunch of tests or just relax the comparison strings a bit: else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1 )
    || (OS.indexOf("windows 2003") > -1 ) // works but is quite specific to 2003
    || (OS.indexOf("windows xp") > -1) ) {
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 20") > -1 ) // probably is better since no other OS would return "windows" anyway
    || (OS.indexOf("windows xp") > -1) ) {
    I started with "windows 200" but thought "what the hell" and made it "windows 20" to lengthen its longivity. You could push it further and use "windows 2," I suppose. The only thing to watch out for is to not overlap with "windows 9."
    On Windows, pre-JDK 1.2 JVM has trouble reading the Output stream directly from the SET command, it never returns. Here 2 ways to bypass this behaviour.
    First, instead of calling directly the SET command, we use a BAT file, after the SET command we print a known string. Then, in Java, when we read this known string, we exit from loop. [env.bat]
    @set
    @echo **end
    [java]
    if (OS.indexOf("windows") > -1) {
    p = r.exec( "env.bat" );
    while( (line = br.readLine()) != null ) {
    if (line.indexOf("**end")>-1) break;
    int idx = line.indexOf( '=' );
    String key = line.substring( 0, idx );
    String value = line.substring( idx+1 );
    hash.put( key, value );
    System.out.println( key + " = " + value );
    The other solution is to send the result of the SET command to file and then read the file from Java. ...
    if (OS.indexOf("windows 9") > -1) {
    p = r.exec( "command.com /c set > envvar.txt" );
    else if ( (OS.indexOf("nt") > -1)
    || (OS.indexOf("windows 2000") > -1
    || (OS.indexOf("windows xp") > -1) ) {
    // thanks to JuanFran for the xp fix!
    p = r.exec( "cmd.exe /c set > envvar.txt" );
    // then read back the file
    Properties p = new Properties();
    p.load(new FileInputStream("envvar.txt"));
    Thanks to JP Daviau
    // UNIX
    public Properties getEnvironment() throws java.io.IOException {
    Properties env = new Properties();
    env.load(Runtime.getRuntime().exec("env").getInputStream());
    return env;
    Properties env = getEnvironment();
    String myEnvVar = env.get("MYENV_VAR");
    To read only one variable : // NT version , adaptation for other OS is left as an exercise...
    Process p = Runtime.getRuntime().exec("cmd.exe /c echo %MYVAR%");
    BufferedReader br = new BufferedReader
    ( new InputStreamReader( p.getInputStream() ) );
    String myvar = br.readLine();
    System.out.println(myvar);
    Java's System properties contains some useful informations about the environment, for example, the TEMP and PATH environment variables (on Windows). public class ShowSome {
    public static void main(String args[]){
    System.out.println("TEMP : " + System.getProperty("java.io.tmpdir"));
    System.out.println("PATH : " + System.getProperty("java.library.path"));
    System.out.println("CLASSPATH : " + System.getProperty("java.class.path"));
    System.out.println("SYSTEM DIR : " +
    System.getProperty("user.home")); // ex. c:\windows on Win9x system
    System.out.println("CURRENT DIR: " + System.getProperty("user.dir"));
    Here some tips from H. Ware about the PATH on different OS.
    PATH is not quite the same as library path. In unixes, they are completely different---the libraries typically have their own directories. System.out.println("the current value of PATH is: {" +
    p.getProperty("PATH")+"}");
    System.out.println("LIBPATH: {" +
    System.getProperty("java.library.path")+"}");
    gives the current value of PATH is:
    {/home/hware/bin:/usr/local/bin:/usr/xpg4/bin:/opt/SUNWspro/bin:/usr/ccs/bin:
    /usr/ucb:/bin:/usr/bin:/home/hware/linux-bin:/usr/openwin/bin/:/usr/games/:
    /usr/local/games:/usr/ccs/lib/:/usr/new:/usr/sbin/:/sbin/:/usr/hosts/:
    /usr/openwin/lib:/usr/X11/bin:/usr/bin/X11/:/usr/local/bin/X11:
    /usr/bin/pbmplus:/usr/etc/:/usr/dt/bin/:/usr/lib:/usr/lib/lp/postscript:
    /usr/lib/nis:/usr/share/bin:/usr/share/bin/X11:
    /home/hware/work/cdk/main/cdk/../bin:/home/hware/work/cdk/main/cdk/bin:.}
    LIBPATH:
    {/usr/lib/j2re1.3/lib/i386:/usr/lib/j2re1.3/lib/i386/native_threads:
    /usr/lib/j2re1.3/lib/i386/client:/usr/lib/j2sdk1.3/lib/i386:/usr/lib:/lib}
    on my linux workstation. (java added all those execpt /lib and /usr/lib). But these two lines aren't the same on window either:
    This system is windows nt the current value of PATH is:
    {d:\OrbixWeb3.2\bin;D:\jdk1.3\bin;c:\depot\cdk\main\cdk\bin;c:\depot\
    cdk\main\cdk\..\bin;d:\OrbixWeb3.2\bin;D:\Program
    Files\IBM\GSK\lib;H:\pvcs65\VM\win32\bin;c:\cygnus
    \cygwin-b20\H-i586-cygwin32\bin;d:\cfn\bin;D:\orant\bin;C:\WINNT\system32;C:\WINNT;
    C:\Program Files\Dell\OpenManage\Resolution Assistant\Common\bin;
    d:\Program Files\Symantec\pcAnywhere;
    C:\Program Files\Executive Software\DiskeeperServer\;C:\Program Files\Perforce}
    LIBPATH:
    {D:\jdk1.3\bin;.;C:\WINNT\System32;C:\WINNT;d:\OrbixWeb3.2\bin;D:\jdk1.3\bin;
    c:\depot\cdk\main\cdk\bin;c:\depot\cdk\main\cdk\..\bin;
    d:\OrbixWeb3.2\bin;D:\Program Files\IBM\GSK\lib;
    H:\pvcs65\VM\win32\bin;c:\cygnus\cygwin-b20\H-i586-cygwin32\bin;d:\cfn\bin;
    D:\orant\bin;C:\WINNT\system32;
    C:\WINNT;C:\Program Files\Dell\OpenManage\ResolutionAssistant\Common\bin;
    d:\Program Files\Symantec\pcAnywhere;
    C:\Program Files\Executive Software\DiskeeperServer\;C:\Program Files\Perforce}

  • Finde Info.plist

    I was using PlistEdit Pro to edit the Finder's Info.plist and the app corrupted the file as a result of which Finder can't doesn't start anymore. I know I should have made a backup but didn't as in the past this has never been an issue. But after updating to Mavericks, it seems that certain trivial things are not quite the same anymore. Anyway, the Info.plist is totally f%*$ed and I was wondering whether it is possible to find it online somewhere for download. I already re-installed Mavericks once and it took a bloody 90 mins. I'd rather skip the wait if possible. Thanks.

    thanks R C-R. exactly right.  @tuttle: i don't have Xcode. that being said, PlistEdit Pro let's me add 'LSUIPresentationMode -int 4' to Firefox/Chrome/Terminal etc plist files without any problems. it removes the menubar for Firefox, Terminal and some other non-Apple apps, but crashes Evernote/Mail/Preview/Activity Monitor (in general most Apple apps), and does nothing for Chrome although it used to before the current version.
    but the most interesting point is this: before installing Mavericks, i was running the latest 10.8 OS update and was able to use this trick just fine to show/hide the Finder's menubar with PlistEdit Pro. after updating to Mavericks, the Finder crashes immediately upon relaunch after adding LSUIPresentationMode -int 4 to its plist.
    so since i demonstrated that PlistEdit Pro can be used successfully to edit some user apps on Mavericks, and it also was working fine on Finder before the OS update, isn't the logical conclusion that something connected to the Finder and the new OS code has changed in regards to how plists are handled for system apps? the error message spews forth some complaint about Finder.app having the wrong code signature or some such after the edit is saved to the plist and Finder is relaunched (can't remember the exact wording now, but that's the gist of it).
    does Mavericks do something like recompute some sort of hash every single time any file associated with a system app has changed and since plist changed, it screws up the hash, causes the OS to falsely conclude the app has been modified 'illegally' and thus may be a security breach and blocks it from running?

  • Info.plist in IOSerialFamily.kext

    I deleted the Info.plist, found a new one on the web. Created a txt file, saved it as Info.plist and moved it to the IOSerialFamily.kext
    Upon start up I am told that the IOSerialFamily.kext was not installed correctly and cannot be used.
    What did I do wrong? Thanks
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>IOSerialFamily</string>
    <key>CFBundleGetInfoString</key>
    <string>Apple Computer, Inc 2005-01-12 IOKit Serial Port Family</string>
    <key>CFBundleIdentifier</key>
    <string>com.apple.iokit.IOSerialFamily</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>IOKit Serial Port Family</string>
    <key>CFBundlePackageType</key>
    <string>KEXT</string>
    <key>CFBundleShortVersionString</key>
    <string>9.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>9.0.0d30</string>
    <key>IOKitPersonalities</key>
    <dict>
    <key>IOSerialBSDClient</key>
    <dict>
    <key>CFBundleIdentifier</key>
    <string>com.apple.iokit.IOSerialFamily</string>
    <key>IOClass</key>
    <string>IOSerialBSDClient</string>
    <key>IOProbeScore</key>
    <integer>1000</integer>
    <key>IOProviderClass</key>
    <string>IOSerialStream</string>
    <key>IOResourceMatch</key>
    <string>IOBSD</string>
    </dict>
    <key>IOSerialBSDClientSync</key>
    <dict>
    <key>CFBundleIdentifier</key>
    <string>com.apple.iokit.IOSerialFamily</string>
    <key>IOClass</key>
    <string>IOSerialBSDClient</string>
    <key>IOProbeScore</key>
    <integer>1000</integer>
    <key>IOProviderClass</key>
    <string>IOSerialStreamSync</string>
    <key>IOResourceMatch</key>
    <string>IOBSD</string>
    </dict>
    </dict>
    <key>OSBundleCompatibleVersion</key>
    <string>1.0.4</string>
    <key>OSBundleLibraries</key>
    <dict>
    <key>com.apple.kpi.bsd</key>
    <string>8.0.0</string>
    <key>com.apple.kpi.iokit</key>
    <string>8.0.0</string>
    <key>com.apple.kpi.libkern</key>
    <string>8.0.0</string>
    <key>com.apple.kpi.mach</key>
    <string>8.0.0</string>
    <key>com.apple.kpi.unsupported</key>
    <string>8.0.0</string>
    </dict>
    </dict>
    </plist>

    I just got a copy of this info.plist and everything´s fine!!!!!!!!!!

  • How to restore info.plist on my bootcamp.app ?

    After following this instruction https://discussions.apple.com/message/17365855#17365855
    I accidentaly overwrite my info.plist and now bootcamp couldn't started.
    how can I restore my info.plist again?

    Try here:
    http://email.about.com/od/YahooCalendarTips/qt/How-To-Sync-Yahoo-Calendar-With-I phone-Calendar.htm
    Google is your friend.

  • CLASSPATH Environment Variable on Win2k problem

    hi
    i am new to java, but having problems to seting the CLASSPATH Environment Variable on my Win2k professional. my university computers are alredy set and i enjoy working with java. i just cant get my head arround to this problem. it would be much appriciated if some one send me a link which provide screenshot to resolve this problem. i got my jdk1.4 kit in a folder caled jdk in c:\ root.
    thanks

    Ashwani_Saxena wrote:
    Our application is stand-alone application and we are using Applet with Object Id tag for JavaScript to Java connectivity. In our application we are displaying the value of classpath environment variable on screen.
    Applets and stand alone applications are two different animals.
    While migrating from JRE 1.5 to JRE 1.6, we are unable to retrieve the classpath variable value. After analyzing, figure out that when classpath is defined in uppercase (i.e. CLASSPATH) then only we are unable to retrieve its value. However if its defined in lower case or any character is in lower case (i.e. classpath) then its value appears correctly. We are retrieving the classpath value via the "Set" command from Java.
    That's completely unnecessary, there's a System.getevn("CLASSPATH") method.
    However the CLASSPATH environmental variable isn't much use, and certainly not in the case of Applets, which definitely don't use it.
    Futhermore I don't expect the sandbox environment of an Applet will allow you to access the environmental variables in any way, (certainly not by running a program). Applets, unless signed, have almost no access to the client machine they run on.

  • Add firewall rule with custom environment variable in program path

    Hi,
    We want to create a firewall rule for a program which is placed in folder which changes sometimes. I know you can add a firewall with the ProgramFiles environment variable like this:
    netsh advfirewall firewall add rule name="Test Firewall rule" dir=in program="%%ProgramFiles%%\Test\Test.exe" action=allow security=notrequired
    The environment variable ProgramFiles isn't expanded and if the Program Files folder is different on a system the rule still works.
    We try to use this with a custom environment variable which we set a system environment variable with this command:
    SETX SomeFolder "D:\Some Folder\Apr 2015" /M
    If we use the command below to add the firewall rule in a batch file the environment variable SomeFolder is expanded correctly and the program path is added as a static path.
    netsh advfirewall firewall add rule name="Some Firewall Rule" dir=in program="%SomeFolder%\AFile.exe" action=allow security=notrequired
    Because the folder changes sometimes we want to change the environment variable SomeFolder and not remove the old firewall rule and create a new one. We want to add the environment variable SomeFolder to the program path as a (dynamic) environment variable
    and not as the expanded path at the moment when the rule is added. If we use this command:
    netsh advfirewall firewall add rule name="Some Firewall Rule" dir=in program="%%SomeFolder%%\AFile.exe" action=allow security=notrequired
    We get the error:
              Windows Firewall with Advanced Security
              An error occurred while adding the rule.
              Error: The parameter is incorrect
              Status: The application name could not be resolved
              OK   
    Why can't we use %%SOMEFOLDER%% like we can use %%PROGRAMFILES%%? The same error is shown when we try to add the firewall rule through the management console 'Windows Firewall with Advanced Security'
    W. Spu

    Hi,
    Based on my plenty of test with this problem, it seems like there is no better method to achieve your requirement. To add new policy to firewall, it would be better using general cmdlet. The path parameter like %%SomeFolder%% do have problem in add firewall
    policy cmdlet. 
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Java environment variables

    Hi,
    Just curious... What are the different environment variables that Java looks at, and what is the purpose for each of them?? To clarify that I'm talking about, I think some of them are JAVA_HOME, JAVAC(?), CLASSPATH, etc.
    Thanks

    There are three environment variables that Java generally uses:
    1. PATH
    2. CLASSPATH
    3. JAVA_HOME
    PATH is actually a windows environment variable where you specify the paths of executable files. For Java, this environment variable helps it locate java compiler, java runtimes - java, javaw and other tools in the JDK.
    CLASSPATH is specific to Java; it helps Java tools find Java class files
    JAVA_HOME is used by Java Applications to point to the directory where JDK is installed.
    For the current status of environment variables in Windows, run a command prompt and type 'set' (without quotes) followed by enter. Windows will then list all environment variables defined.

Maybe you are looking for

  • USB 2.0 not functioning properly after upgrading to 3.10.3-1 kernel

    After upgrading to the 3.10.3-1 kernel USB 2.0 is not working anymore on my ASrock ION330 nettop. I just did a system upgrade (including a kernel upgrade to 3.10.5-1), but the problem remains... Here's the relevant messages that I extracted with jour

  • Black and White Screen

    My Iphone 4 has been shutting down to a black dos like screen with White letters. Debugger messag: panic\ OS Version: not yet set Kernel Version: Darwin Kernel Version 13.0 Sunday August 19 I b boot version: i Bott-1537.4.18 panic: we are hanging her

  • Order list not linking through to detail view

    Hi all, I'm creating an order list in a secure zone, each order needs to link to the invoice of that order (the detail view). I have read: http://forums.adobe.com/message/4348407#4348407 and http://kb.worldsecuresystems.com/838/cpsid_83807.html?bc-pa

  • Using ABAP DATA FLOW to pull data from APO tables

    I am trying to use an ABAP Data flow to pull data from APO and receive error 150301. I can do a direct table pull and receive no error, but when I try to put it in an ABAP data data flow I get the issue. Any help would be great.

  • Javascript and sql select statement

    I am working in html db in the 10 g environment. I'm trying to create an "auto suggestion function" that predicts values as the user enters characters into a text field. I've gotten it to work by hard coding the values in the function, ie: states. bt