This problem comes from a difference between the Sun and Eclipse compiler (the latter is the better and faster one in my experience)
There are three solutions
Add a bunch of extra casts to your code, so the type inference will be easier for the compiler. I think this might already solve the problem:
int peProductQuantity = (int) ((Long) element.getValue(this.getContext(), "Quantity"));
Always compile using eclipse
BTW, this problem is not caused by the third party libraries
The compile error that you get when running from the Modeler appears to be a bug in the Oracle Java compiler. Eclipse uses its own compiler that does not contain that bug.
The solution is to change your Java code to work around the compiler bug.
See this page for more information about the bug and how to work around it.
It looks like the modeler can't find the jar you're referencing. Where exactly did you put the jar file? It should be under myprojectdir/userlib (and not under myprojectdir/deployment/userlib/)
Dear Benny,
Thanks for your reaction. My question would then be: is the code that causes the problem in my java-action or in the jar-files I reference?
I'm not really (or really not :-) ) a java-developer, but produced this code. Here I indicated which line causes the compilation-error. Should this code-part be changed, or should my java-colleagues change their code?
// get orderlines of the order
List<IMendixObject> result = Core.retrieveXPathQuery(this.getContext(),
"//Order_Management.OrderLines[Order_Management.OrderLines_Order='"
+ this.jOrder.getGUID() + "']");
// define iterator
Iterator<IMendixObject> iterator = null;
iterator = result.iterator();
// loop through orderLines
while (iterator.hasNext()) {
IMendixObject element = iterator.next();
long peProductQuantity;
peProductQuantity = 0;
/*the lines below work in both mendix and eclipse!!*/
ILogNode logger = Core.getLogger("TestQuantity");
logger.info("Quantity: "+ element.getValue(this.getContext(), "Quantity"));
//when the line below is commented out, I can compile in the modeler, if not, I can't
peProductQuantity = element.getValue(this.getContext(), "Quantity");
// Fill in product details
Product product = new Product();
product.setQuantity((int) peProductQuantity);
order.getProducts().add(product);
}
If there is an alternative for the code above (that works around the problem), I'm glad to hear; if not, I will ask the guys of the 3rd party system I connect with.