Java Sample

Below are the steps to use for the Java sample with Eclipse IDE running or by running on the command line. Java sample is not installed with Metadefender Core. You must download this separately from the OPSWAT portal. Go to https://portal.opswat.com/en/content/metadefender-core-sample-code, and click Download .

With the Eclipse IDE running:

  1. Create a new Java project from existing source code. (Choose the Java sample code folder you have downloaded).

  2. Add Metasscan_java_interface.jar to the build path of the project. By default, Metascan_java_interface.jar file is installed in the directory where Metadefender Core is installed under the JNI folder.

  3. Set java argument of Native library path to “omsJInterfaceImple.dll”

Example: -Djava.library.path=C:/Program Files (x86)/OPSWAT/Metadefender Core 8/JNI (in vm arguments of “Run Configuration”)

Running on the Command Line:

  1. Go to bin directory.

  2. Run the following command:
    Java.exe -cp .;<absolute path to Metascan_java_interface.jar file> -Djava.library.path=<absolute path to omsJInterfaceImpl.dll> com.opswat.metascan.Sample