How to access a global variable created in one URCap and use it in another URCap?

I have 2 Program Node URcaps.
I need to access a value generated from the 1st URcap and use it in the 2nd URCap.
I need to do this task using java with the help of global variable.
I checked the samples like cyclecounter and idletime, but still i couldn’t succeed.

Any help would be very much appreciated.
Thanks in advance.

The easiest way to achieve this is implementing both urcaps in one urcap package and add a singleton class to that package which both urcaps can communicate with. There is also a interface for urcap communication. See this post

There are also a ton of threads on how to use global (robot) variables in urscript, installaion nodes and for communication (which i wont recommend if you need it on the java layer)

Thank you for your response.

Yes, both the Program Nodes/ URCaps were created in the same package (no parent child relationship).

Until now for sharing the values between Program Nodes i was using global variables from URScript, but the communication was only between URScript layer of both the nodes.
The current situation is i need to use the global variable created from URScript and call the value from the Java layer. That’s when i decided to create (global variable ) and access the value from java layer, which i couldn’t succeed.

I am looking for a feasible approach to achieve this. I will check out the singleton class and proprietary API.
Thanks a lot for your help.

You could also try using the function model interface, this should allow you to create a function that can be accessed in the program tree and be used by the URCap.

Thank you for your response.

It was a good idea, but it was just required to read the binary values from the Digital Outputs, so it was solved with a simple URScript command.