Mac OS X folder permission problem or Java problem

Posted on 2011-10-10
Last Modified: 2012-08-17
I am testing PHP with java on Mac OS X Server, when I running following PHP, no any response, is it related to Mac OS X folder permission problem or other issues !

PHP code

echo exec ("java -jar /var/www/uploads/delta/odt-compare-command.jar compare .$p1 .$fp2 .$p3",$results);
      echo $results;

When I run command line with non-root user, the following error message shown on terminal

Mon Oct 10 15:16:44 testingdomain java[11787] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Exception in thread "main" java.lang.InternalError: Can't connect to window server - not enough permissions.
      at java.lang.ClassLoader$NativeLibrary.load(Native Method)
      at java.lang.ClassLoader.loadLibrary0(
      at java.lang.ClassLoader.loadLibrary(
      at java.lang.Runtime.loadLibrary0(
      at java.lang.System.loadLibrary(
      at Method)
      at java.awt.Toolkit.loadLibraries(
      at java.awt.Toolkit.<clinit>(
      at java.awt.Color.<clinit>(
      at com.deltaxml.odf.comp.OdtComparator.<clinit>(Unknown Source)
      at com.deltaxml.odf.comp.OdtComparatorDriver.main(Unknown Source)
Question by:liyy
    LVL 47

    Assisted Solution


    I'm not sure about Mac, but it looks like similar to like  X Windows server does not allow to open window to the client - can't it be something similar
    Usually xhost + command on the server or something  like that was helping me

    LVL 47

    Accepted Solution

    LVL 86

    Assisted Solution

    Does that particular Java program require a windowing  environment? If it doesn't, you might try running with the following:

    echo exec ("java -Djava.awt.headless=true -jar /var/www/uploads/delta/odt-compare-command.jar compare .$p1 .$fp2 .$p3",$results);
          echo $results;

    Open in new window


    Author Comment


    let me try it and feed back here.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    This video teaches viewers about errors in exception handling.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now