Issues with librobot.dylib

Share any Issues you may have had and any solutions you found.
Post Reply
kayjk83
User
User
Posts: 2
Joined: Tue Apr 28, 2015 3:02 pm
First Name: Kathrin-Jennifer
Last Name: Kunze
Company: Cybercon

Issues with librobot.dylib

Post by kayjk83 » Wed Apr 29, 2015 7:21 am

Hi,

I'm using Mac OS X with the latest beta of T-Plan Robot (4.0.2Beta-20150421.1). A message is shown when T-Plan is started within my application:

Failed to read the system clipboard: The librobot.dylib library was not found!
Make sure that the librobot.dylib library is in the same folder as the robot.jar file (currently /Users/kathrinjennifer/.m2/repository/com/tplan/robot/4.0.2Beta-20150421.1). Alternatively pass the library folder to the Java process through -Drobot.macNativeLayerDir=<path>
The tool will fall back to the Java clipboard API.

Adding the path to the class path variables at runtime within my java application didn't solve the problem.
I don't like to move the lib to the folder where the robot.jar is placed at (since it is loaded from a repository using Maven).

I start T-Plan using the following CLI options:

Code: Select all

AutomatedRunnable runnable = mRobot.createAutomatedRunnable(mExecutedScript, 
    scriptName + "@"+
    Integer.toHexString(mExecutedScript.hashCode()), 
    new String[]{
         "-n",
         "-c", 
        "java://localhost",
},
System.out, false);
Any suggestions?

Thanks!
KayJ

rpes
User
User
Posts: 74
Joined: Thu Oct 29, 2009 5:43 pm
First Name: Robert
Last Name: Pes
Company: T-Plan

Re: Issues with librobot.dylib

Post by rpes » Wed Apr 29, 2015 10:34 am

The librobot.dylib is a dynamic library for Mac OS. Robot is designed to look for it in the same folder where robot.jar is. Adding the lib path to the class path won't work.

The only other way is to use the undocumented JVM flag of robot.macNativeLayerDir. Be aware that it was introduced in 4.0.2Beta in Feb 2015 and it won't work on older releases. Example:

Code: Select all

java -Drobot.macNativeLayerDir=<path_to_dylib_dir> -jar robot.jar ....
This path may be difficult to set from a 3rd party Java code because the lib loading is done very early from a static initializer of a Robot's framework class. You could possibly set the property from Java code through System.setProperty(String, String) but you must ensure that it gets called before the Robot classes are initialized. It may work if done from static initializer of your own class (untested):

Code: Select all

class MyApp {
   static {
      System.setProperty("robot.macNativeLayerDir", "<path_to_dylib_dir>");
   }

   // Use Robot classes in the main() or class methods 
}
We could eventually improve this in the future. For example, we could pack the dylib to the robot.jar file and get it extracted to and loaded from a temporary folder. We however need to be careful here because some of our clients run the tool on very isolated environments.

kayjk83
User
User
Posts: 2
Joined: Tue Apr 28, 2015 3:02 pm
First Name: Kathrin-Jennifer
Last Name: Kunze
Company: Cybercon

Re: Issues with librobot.dylib

Post by kayjk83 » Thu Apr 30, 2015 7:54 am

Static loading works perfectly fine! Thanks for that!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest