views:

25

answers:

1

Hello, I want to import a class that I made in my project, into my script I did this but it doesn't work:

    function doFunction(){
 //Objectif Mensuel
 importPackage(java.lang);
 importClass(KPDataModel.KPData.KPItem); //ERROR HERE, this is my class that I want to import

 KPItem kpItem = kpItemList.get(0);
 System.out.println(kpItem.CellList.get(2).Value);
 System.out.println("-------");
 var proposedMediationSum = Integer.parseInt(kpItemList.get(0).CellList.get(2).Value);
 var refusedMediationSum = Integer.parseInt(kpItemList.get(0).CellList.get(3).Value)
 var totalMediation = proposedMediationSum + refusedMediationSum;

 kpItemList.get(0).CellList.get(4).Value = totalMediation;

}
A: 

Well, thnx a lot, I found that the problem comes from the import. This is what it said in the Oracle website :

The Packages global variable can be used to access Java packages. Examples: Packages.java.util.Vector, Packages.javax.swing.JFrame. Please note that "java" is a shortcut for "Packages.java". There are equivalent shortcuts for javax, org, edu, com, net prefixes, so pratically all JDK platform classes can be accessed without the "Packages" prefix.

So, to import my class I used : importClass(Packages.KPDataModel.KPData.KPItem);

taichimaro