Forum Discussion

CDurkin's avatar
CDurkin
Contributor
13 years ago

Code complete on JavaClasses not working

I am following the help module "Calling Functions from Java Classes"



Everything works fine until I type in JavaClasses, them codecomplete does not work, nothing comes up and I don't get any error message.



Any suggestions?



Thanks

Chris Durkin

4 Replies

  • Claudiu_Adam's avatar
    Claudiu_Adam
    Occasional Contributor
    Hi. I had the same issue, but it is solved if you indicate correctly the class name and the jar is loaded.



    In my case I had this structure under my jar: check picture1 for details..



    Class name is: packageName.className

    In my case: PdfBox4JScript.PdfBoxTests



    Check picture 2 to see how it looks the Java Bridge window.



    Java Bridge is supported only from TestComplete 8.0.



  • Hi Chris,


    It seems that the class you want to access uses other classes that are located in specific directories, and you did not specify them in TestComplete's Java Bridge options. So, TestComplete cannot access the needed Java class. Since the class is unavailable, it is not displayed in the Code Completion window.


    To check whether your class can be accessed only with class paths you specified, you can do this:



    1. Create a simple Java application. 

    2. From the main() method, call that particular class function that you want to call from your TestComplete test .

    3. Run the application and specify the paths which you specified in the Class Path list of the Java Bridge options as the classpath parameters (you must specify the class paths in the same order as they are specified in TestComplete).


    If the application works correctly, this means you specified correct class paths. Otherwise, you need to determine which class paths you need to specify in order to access the desired Java class. Until all the needed classes are specified, the application cannot call the desired function. Once your faked application works correctly, add the same class paths you specify as the classpath parameters into TestComplete's Java Bridge settings.


    I hope this will help. If it does not, contact me please.

  • ramesh_dalavai's avatar
    ramesh_dalavai
    Occasional Contributor
    Hi,



    Im facing the similar issue where

    I add the jvm.dll in java bridge

    add all the java classes which are under a target folder in C drive

    add the folder in classpath



    but when i type JavaClasses in the testcomplete project script file nothing gets returned

    Can you please let me know ?

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,


     


    Did you add the paths to the packages of Java classes, as well as the classes names?


    This is a quote from the "Calling Functions From Java Classes" article:


    >>  TestComplete requires that the specified name contain both the name of the package containing the desired class and the desired Java class name.