Need to import Java library to use customized methods in RIDE

Hi All ,

I am new to Robot framework and trying RIDE Editor tool for web automation.
My requirement is to use existing customized methods/keywords in Java library as earlier I was working with TesTNG in eclipse with Selenium JAVA.

I would like to explain the whole process which I had followed in the attempt of trying to use a method/keyword from a Java class.

Python version – 2.7.15
PIP – 9.0.3
Robot Framework – 3.2.1
Jython – 2.7.0

Created a java project with a class and few public methods and then created a JAR file by exporting the same.
Placed the JAR in C:\Python27\Scripts path and as well as in C:\Python27\Lib\site-packages.
For importing the JAR File, tried few ways which weren’t of help to me:

  1. Found in this link that we are supposed to create a Library spec through libdoc tool or by using Jython.
    Tired to install libdoc tool from the below given URL which was found from the same blog mentioned above -, but was not able to install the same as its throwing error(Error: 404).
  2. Tried to install Jython, but not sure on how to proceed with the creation of spec after that. Basically, we were not aware of creating the spec for a Java based library.
  3. Not sure how to add the spec file to PYTHONPATH as we are stuck in the above mentioned point itself.
  4. In the RIDE tool, created a test suite and then clicked on Add Import’s (Library). Gave the class name (fully qualified name) as org.robot.sample.keywords.SampleKeywordLibrary in the Name part. Clicked on Ok. Also tried specifying only the jar file’s name.

After adding the same, found that the library added is highlighted in “Red” color which I understand that the Import is unsuccessful.
Found the Failed error logs in RIDE’s Log:

Importing test library ‘SampleKeywordLibrary’ failed: Not a valid file or directory to import.
File “C:\Python27\lib\site-packages\robotide\spec\”, line 87, in _fetch_keywords
return get_import_result(path, library_args)
File “C:\Python27\lib\site-packages\robotide\spec\”, line 24, in get_import_result
lib = robotapi.TestLibrary(path, args)
File “C:\Python27\lib\site-packages\robotide\lib\robot\running\”, line 50, in TestLibrary
File “C:\Python27\lib\site-packages\robotide\lib\robot\utils\”, line 72, in import_class_or_module
self._raise_import_failed(name, err)
File “C:\Python27\lib\site-packages\robotide\lib\robot\utils\”, line 103, in _raise_import_failed
raise DataError(msg)

I would like to know if we have added the JAR in the required places and Can we directly use this jar or we need to create spec – If yes then how?

It would be much helpful If you could let us know at point we are going wrong and with the steps to resolve the same.

Duplicating questions would cause duplicating answers.

See this answer.