Create a Java algorithm project
Last update: 19.06.2026The following instructions are for creating a Java algorithm using the NetBeans IDE. NetBeans can be downloaded for free from netbeans.org.
Create a new algorithm project using NetBeans
-
Create a new project for the Java algorithm by selecting File > New Project from the NetBeans menu.

-
Under Categories, select Java. Then under Projects, select Java Class Library, and then press the Next button.

-
Enter the name of the project and the save location, and then press the Finish button.

-
Right-click on Libraries and select Add JAR/Folder.

-
Locate PHXSolverInfrastructure.jar in the Algorithm Developer Tools directory. Typically:
"C:\Program Files\Phoenix Integration\Algorithm Developer Tools"
-
Right-click on Source Packages and select New > Java Class.

-
Name the algorithm class name and specify its package, then press the Finish button.

-
In the algorithm file, add:
implements com.phoenix_int.optimizationtool.IAlgorithmafter the class name, e.g.,

-
Right-click on IAlgorithm and select Insert Code, then Implement Method:


-
Click the checkbox next to IAlgorithm and IDisposable, then click the Generate button.

-
It is recommended that each algorithm have its own GuidAttribute to uniquely identify the algorithm. To add a GuidAttribute to the algorithm, place attibute before the class definition.
... @GuidAttribute("C247D109-9522-49cd-8597-EB29EA042DFD") public class Algorithm : IAlgorithm { ...
New GUIDs can be generated using Create a GUID or some other similar tool.
Conclusion
The base class for the Java algorithm has now been implemented. The rest of the guide is based on .NET, but the major differences for Java are that properties use get property name and methods start with lowercase letters. Java algorithms install to the same location as the .NET algorithms, and the build file can be modified to move the algorithm to the correct location using the ant copy task.
Add manifest file for algorithm
A manifest file must be added to tell the Optimization Tool which JAR files should be searched for implementations of IAlgorithm. To add the manifest:
-
Right-click on the project in NetBeans and select New > Other from the context menu.
-
Select Other under Categories: and Empty File under File Types: and press the Next button.
-
Name the file manifest.phx and press Finish.
-
The file should be created in the project's base directory. Open the manifest file and enter the name of the JAR file output by the algorithm project. A single manifest file can specify multiple files that contain
IAlgorithmimplementations, but only one file name should be specified per line.
Add algorithm copy to the Java algorithm build process
The algorithm can be moved to a location where the Optimization Tool can locate it automatically by adding the following code to the algorithm's build.xml.
<!-- The following line specifies documents for Windows XP.
For Windows Vista and Windows 7, use "${env.USERPROFILE}\Documents". -->
<property name="documents" value="${env.USERPROFILE}\My Documents" />
<!-- Changed SampleAlgorithm below to be the desired project directory name. -->
<property name="algorithmDir" value="${documents}\Optimization Tool\algorithms\SampleAlgorithm" />
<target name="-post-jar" depends="-copy-to-user, -copy-to-artifacts" />
<target name="-copy-to-user"/>
<echo message="Copying dist directory to user algorithms dir" />
<copy overwrite="true" file="${dist.jar}" todir="${algorithmDir}" />
<copy overwrite="true" file="icon.ico" todir="${algorithmDir}" />
<copy overwrite="true" file="manifest.phx" todir="${algorithmDir}" />
<copy overwrite="true" todir="${algorithmDir}\lib" />
<fileset dir="dist\lib" />
</copy>
<copy overwrite="true" todir="${algorithmDir}\help" />
<fileset dir="help" />
</copy>
</target>