Posted: 2 Mar 2020 12:47 EST Last activity: 4 Mar 2020 10:32 EST
How do I import a java library into my application?
I have tried to import a jar file of the java library using the Import tool but it says "The selected archive is invalid or of an unknown type. " The java library I am trying to import is a color contrast checker that checks if there is any non-compliant color contrasts in my application. Here is the link to the java library
So what I downloaded the zip file of the java library and then converted it to a jar file. Even after doing this, it still shows the same error message. Is there any other way to make sure the jar file is completely extracted and not part of the zip file?
Thank you for confirming that. That pretty much explains the issue.
We should be using the JAR version of the library to be able to import to Pega. The Contrast checker java library from GitHub just offers a source code with maven XML inside the zip file. As there are no physical jar file(s) located inside the zip file, we won't be able to use it on Import wizard.
If you can get a packaged source JAR file, then it can be read by Pega and would be allowed to Import.
I have found another library that serves a similar function. (Checks for Accessibility issues) I am assuming this would also not be able to be imported into the Pega Application. I will provide the link below. Do you have any ideas into how I could obtain the packaged source JAR file since converting the ZIP file to JAR doesn't work?
Also, would it be possible to instead copy the Java code into a function or Activity step and inputting the Java code into my application instead of trying to import the entire library? I am trying to figure out other options to use a Java code or other external API to check the HTML of my application of any non-compliant color contrasts. Thank you for the help Harish!
If it's a JS function, you can include the same piece of code in your HTML Fragment like UserWorkForm and ensure that any requires JS functions(JS file) are included in harness (under "Scripts & styles" tab)
If it's JAVA, the JAR file is the only way.
We can create custom functions or include java steps but I am sure there would be code references to custom class definitions & methods which are not available in standard Pega or App server or JDK libraries and we end up with compile issues.