UFT2023_Not able to Identify JAVA application

Hi Team,

Not able to Identify JAVA application using object spy, it is identifying as window object.

when i record on JAVA application able to generate the script as below.

JavaWindow("X").JavaDialog("Y").JavaEdit("username").Set "testuser"

rerun of recorded script not identifying java application again.

Please help me what could be the issue..?

Regards,

  • 0

    JAVA application is using  JRE version is 17.0.7-7 

  • 0  

    Hi Shashu,

    For UFT One to identify Java objects in Java 16 or later, you must specify the following options when you run your Java applications:

    --add-modules=java.desktop --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED

    You can specify these options in one of the following ways: 

    • Include the options in the Java command that you use to run your application.

    • Enter the options in the value of the JDK_JAVA_OPTIONS environment variable. Note that this affects all Java applications that you run on this machine.

    More Details please see UFT one Help Center: Java Add-in (microfocus.com)

     

  • 0 in reply to   

    HI Rosie,

    Thanks for the reply.

    Do i need to create  JDK_JAVA_OPTIONS system environment variable and add below values, can you please help me here to understand..?

    -add-modules=java.desktop --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED

    (Or)

    we are using app_start.cmd file to to launch the java application do i need to add in the cmd file in the beginning .?

  • 0  

    Please try to use below command in bat file to run your application:

    set PathToJRE= C:\Program Files\Java\jdk-17\bin
    cd %PathToJRE%
    start java --add-modules=java.desktop --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED -jar "C:\AUT\Java17\demo.jar"

    Note: 

    PathToJRE is your own JDK path

    "C:\AUT\Java17\demo.jar" changes to your own Java application path 

  • 0 in reply to   

    when i run this batch file, we got error " java.destop is not recogonized as an internal or external command, operable program or batch file" how to fix this issue