我想将我在项目中创建的类导入到我的脚本中
我这样做但它不起作用:
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;
}
最佳答案
好吧,thnx很多,我发现问题来自导入.
这就是它在Oracle网站上所说的:
原文链接:https://www.f2er.com/java/437689.html这就是它在Oracle网站上所说的:
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.
所以,要导入我使用的类:importClass(Packages.KPDataModel.KPData.KPItem);