home › Forums › # Technical Support › Create engine in Netbeans Java › Reply To: Create engine in Netbeans Java
Hi Roxanne,
thank you for your email.
First, you will need to create a new Java Application project in NetBeans. In the project, you need to add the jfuzzylite.jar file that you can download from http://www.fuzzylite.com/downloads. Once you have done this, the next step is to create your class that will utilize the Fuzzy Engine you have exported from QtFuzzyLite. There are different ways you can achieve this, but an example of your class would be as follows:
public class Roxanne{
private Engine engine;
public MyFuzzyClass(){
//setup the engine,
engine = new Engine();
engine.setName(“Traffic Light Controller”);
//and the rest of parameters...
}
public Engine getEngine(){
return this.engine;
}
public static void main(String[] args){
Roxanne instance = new Roxanne();
Engine engine = instance.getEngine();
engine.getInputVariable("TQ").setInputValue(10.0);
engine.getInputVariable("WT").setInputValue(2.0);
engine.process();
double output = engine.getOutputVariable("PD").defuzzify();
System.out.println("PD=" + output);
}
}
I think this should give you a starting point to run a basic example. The next step is to loop setting different input values and processing the engine (revise example in http://fuzzylite.com/java). Another good advice is to study object oriented programming, which will help you design the classes to satisfy your needs.
Let me know if this information helps you, or if you need something else.
Cheers,
Juan.