Answered question

How to call JAVA code from a NeoLoad Javascript?

I created my own JAVA code from Eclipse and i created a JAR file that is working fine. I put the JAR in the "<neoload-project>/lib/jslib/" folder but i have this error when i try to call my JAVA code from a NeoLoad Javascript:

TypeError: Cannot call property MyAction in object [JavaPackage NL]. It is not a function, it is "object". Why is it not working?

That error is a very generic. Basically it means that NeoLoad was not able to use your JAVA code. It can be because of the content of your JAVA code (private instead of public) , the Class that is not found 

or simply because the JAR or the Classes cannot be loaded at all.

Make sure that you called the fully qualified name of your Classes preceded by "Packages" like described in the NeoLoad documentation.

 

NeoLoad uses its own JAVA version. If you compile your JAVA classes with a higher JDK version compared to the one used by NeoLoad, it will not work. For example, in NeoLoad 5.0.xx, the JRE version used is a 1.7.xx. If you compile your code with a JRE 1.8.xx then you will get the error mentioned above. To avoid that issue, make sure to compile your JAVA code with the same JRE version used by NeoLoad or even older.

You can see the NeoLoad JRE version used in the NeoLoad log files accessible through the menu "Help-->Open logs folder..."

Did you find this useful ?

No (0)

Yes (1)

100%

100% of users found this answer useful