Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Import Jar in Component

Hello,

 

I am writing a component for TOS 6.4.1 in which I want to use ARX Anonymasiation (http://arx.deidentifier.org/). I downloaded the jar from the homepage and importet it to my component (see the XML) and added it to the Java Build Path in TOS.

 <IMPORTS> 
      <IMPORT MODULE="libarx-3.6.0.jar" NAME="libarx" REQUIRED="true"/> 
    </IMPORTS> 

Now I want to use one of the classes.

In the _begin.javajet file I write

imports="
		org.talend.core.model.process.INode 
		org.talend.core.model.process.ElementParameterParser 
		org.talend.core.model.metadata.IMetadataTable 
		org.talend.core.model.metadata.IMetadataColumn 
		org.talend.core.model.process.IConnection
		org.talend.core.model.process.IConnectionCategory
		org.talend.designer.codegen.config.CodeGeneratorArgument
		org.talend.core.model.metadata.types.JavaTypesManager
		org.talend.core.model.metadata.types.JavaType
		java.util.List 
		java.util.Map
		org.deidentifier.arx.ARXAnonymizer
	" 
%>
<% 
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();

 	
org.deidentifier.arx.ARXAnonymizer anonymizer = new org.deidentifier.arx.ARXAnonymizer.ARXAnonymizer();
%>

but I keep getting an error message "The import org.deidentifier cannot be resolved".

 

Thanks for your help.

Labels (1)
21 Replies
Anonymous
Not applicable
Author

Any code inside <% %> is processed by javajet template engine. Javajet engine is like preprocessor that outputs, java code which is later again complied by studio before execution.
So in our case whats happening ?
*Although jar is loaded correctly, it cant be imported and used for javajet engine codes.

Try putting your line of code, which gave the error ,at the end of javajet file outside <%%>.

Have a look at simple javajet file that uses a third party json lib.
https://github.com/Chirgal/tComponents/blob/master/src/main/java/tXmlToJson/tXmlToJson_begin.javajet
Anonymous
Not applicable
Author

Thank you so, so much! 0683p000009MACJ.png

That really was the problem, I finally got it.

 

Greeting,

Miri