The same file “.jar” that I am using in my Windows 10 machine is not working on Linux. I need to use some specific dependency?
This is the message received when I tryied to run using Linux.
$ java -jar Test.jar step1
Exception in thread “main” java.lang.NoClassDefFoundError: org/camunda/bpm/engine/variable/Variables
at com.financiamento.brms.projeto.Imovel.prepareVariableMap(Test.java:64)
at com.financiamento.brms.projeto.Imovel.main(Test.java:29)
Caused by: java.lang.ClassNotFoundException: org.camunda.bpm.engine.variable.Variables
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 2 more
"
package com.financiamento.brms.projeto;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import org.camunda.bpm.dmn.engine.DmnDecision;
import org.camunda.bpm.dmn.engine.DmnDecisionRuleResult;
import org.camunda.bpm.dmn.engine.DmnDecisionTableResult;
import org.camunda.bpm.dmn.engine.DmnEngine;
import org.camunda.bpm.dmn.engine.DmnEngineConfiguration;
import org.camunda.bpm.engine.variable.VariableMap;
import org.camunda.bpm.engine.variable.Variables;
public class Test {
private static final List Steps = Arrays.asList(“step1”, “step2”, “step3”);
public static void printUsage(String errorMessage, int exitCode) {
System.err.println("Error: " + errorMessage);
System.err.println("Usage: java -jar Test.jar step1");
System.exit(exitCode);
}
public static void main(String[] args) {
validateInput(args);
VariableMap variables = prepareVariableMap(args);
// parse decision from resource input stream
InputStream inputStream = Test.class.getResourceAsStream("DiagramaTest.dmn");
try {
parseAndEvaluateDecision(variables, inputStream);
} finally {
try {
inputStream.close();
} catch (IOException e) {
}
}
}
protected static void validateInput(String[] args) {
// parse arguments
if (args.length != 1) {
printUsage("#### Missing necessary information: step1", 1);
}
String steps = args[0];
if (!Steps.contains(steps)) {
printUsage("Wrong input: " + Steps, 2);
}
}
protected static VariableMap prepareVariableMap(String[] args) {
String steps = args[0];
// prepare variables for decision evaluation
VariableMap variables = Variables.putValue("steps", steps);
return variables;
}
protected static void parseAndEvaluateDecision(VariableMap variables, InputStream inputStream) {
// create a new default DMN engine
DmnEngine dmnEngine = DmnEngineConfiguration.createDefaultDmnEngineConfiguration().buildEngine();
DmnDecision decision = dmnEngine.parseDecision("test", inputStream);
// evaluate decision - for a single output
DmnDecisionTableResult result = dmnEngine.evaluateDecisionTable(decision, variables);
// returns the first rule result
DmnDecisionRuleResult outputValue = result.getFirstResult();
// print result
System.out.println("Your output is: " + outputValue.values());
}
}
"