Re: Java Library Classpath

392 views
Skip to first unread message

GerhardH

unread,
Jul 26, 2012, 9:02:25 AM7/26/12
to robotframe...@googlegroups.com
Hi,
 
usually the import line in Setting table imports a library, not a class. I assume it is not possible to specify a class at that point. Try importing the library instead (i.e. the name of the main class in your library, not the keyword class).
 
Best regards
Gerhard

Am Dienstag, 24. Juli 2012 21:09:09 UTC+2 schrieb CLAYTON:
Hiya,

I have developed a static keyword library in Java and packaged it as a .jar
The class providing the keyword is "KeywordClass" in package "com.clayton.robot"
In the test case file i have:

*Setting*    *Value*
Library    com.clayton.robot.KeywordClass

I am using robot jython standalone .jar file and the keyword .jar file is in the same directory as robot .jar file.
I execute the test case via a .bat with command:

java -jar robotframework-2.7.3.jar TestCase1.txt

However this gives an exception:

This gives an exception when running the test : "Error in file 'D:\Clayton\RobotTests\TestCase1.txt' in table 'Setting': Importing test library 'com.clayton.robot.KeywordClass' failed: ImportError: No module named clayton"

I have tried setting the keyword .jar on the class path by altering the .bat file to have:

SET CLASSPATH=<full path to keyword.jar>
java -jar robotframework-2.7.3.jar TestCase1.txt

But i get the same error.

Can anyone let me know how to properly set CLASSPATH so that Robot Framework can find my class in my jar file.

Thanks,
Clayton



David

unread,
Jul 26, 2012, 7:09:14 PM7/26/12
to robotframe...@googlegroups.com
Just some thoughts, have you tried using library with normal RF installation (Python + Jython installed), in case there is issue with the RF JAR method.

And have you tried using your keyword class outside of RF, like calling the code from standalone Java or Jython by referencing the JAR in its classpath? Just to make sure your library is working ok itself.

CLAYTON

unread,
Jul 27, 2012, 12:21:40 PM7/27/12
to robotframe...@googlegroups.com
Thanks got it working using the .bat file sample on the wiki to build the class path from a directory of jar files.
Reply all
Reply to author
Forward
0 new messages