# Java Task

Use the **Java Task** node to execute **custom Java logic** as part of a Microflow or Process Flow.\
Java Task provides a bridge between ONEWEB’s **low‑code integration layer** and **full‑code Java implementation**, allowing highly customized or advanced logic to be incorporated seamlessly.

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FoPONB56Xyz8N8UKDq5U1%2Fimage.png?alt=media&#x26;token=3f9c49f9-d217-4c9b-a471-465a6c4a8475" alt=""><figcaption></figcaption></figure>

***

### Purpose

The **Java Task** is used when built‑in Microflow nodes are not sufficient and **custom Java code** is required.

Typical scenarios include:

* Implementing proprietary or complex algorithms
* Using third‑party Java libraries
* Performing advanced data transformation or validation
* Integrating with systems that provide only Java SDKs

To use Java Task, developers write Java methods, package them as a **JAR file**, and invoke the methods directly from a flow.

***

### Java Task Configuration

The **Java Task Configuration Panel** consists of **three tabs**, each defining a specific aspect of the task.

***

#### General Tab

The **General** tab contains common metadata used by all node tasks:

* Task Name
* Task ID (system‑generated)
* Description

These values help identify and document the Java Task within the flow.

***

#### Business Object Tab

The **Business Object** tab is used to:

* Define input Business Objects passed into the Java method
* Define output Business Objects returned from the Java method

This ensures a clear data contract between the Microflow and the Java implementation.

***

#### Java Parameter Tab

The **Java Parameter** tab is where the Java implementation is selected and configured.

<figure><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FQJXQvO5xlEeGspEcYJRA%2F1?alt=media" alt=""><figcaption></figcaption></figure>

| Property        | Mandatory | Description                                                               |
| --------------- | --------- | ------------------------------------------------------------------------- |
| **Jar Name**    | Yes       | Select or upload the JAR file containing the Java implementation          |
| **Class Name**  | Yes       | Fully‑qualified Java class name. Can be selected using **Get Class Name** |
| **Method Name** | Yes       | Java method to invoke. Must match a compatible method signature           |

#### Auxiliary Actions

* **Choose Jar**\
  Upload a new JAR file or select one from existing uploaded JARs.
* **Get Class Name**\
  Load all available Java classes from the selected JAR.
* **Method Selection**\
  Choose the specific method to execute from the selected class.

***

### Parameter Mapping

After selecting the Java method:

* Open the **Mapping Parameter** screen
* Map Microflow input parameters to Java method arguments
* Map Java method return values back to Microflow parameters

This mapping ensures proper data flow between the Microflow and the Java execution.

***

### Managing Dependency JARs

When Java logic depends on external libraries:

* **Do not bundle dependency JARs into the main JAR**
* Upload dependency JARs separately using the **Upload JAR utility**
* Allow administrators to manage and version shared libraries centrally

This approach:

* Avoids classpath conflicts
* Improves governance of shared utilities
* Simplifies maintenance across environments

***

### Best Practices

* Use Java Task only when built‑in nodes are insufficient
* Keep Java methods focused and reusable
* Follow the single responsibility principle
* Clearly define input/output contracts
* Use environment variables for configuration, not hardcoded values

Java Task should complement Microflow, not replace it.

***

### Summary

The **Java Task** enables ONEWEB applications to combine **low‑code orchestration** with **full‑code Java execution**.

Using Java Task, developers can:

* Extend Microflows with custom Java functionality
* Reuse existing Java libraries and utilities
* Implement advanced or specialized logic
* Maintain clean separation between orchestration and computation

Java Task is a powerful extensibility mechanism for building **enterprise‑grade integrations** in ONEWEB while preserving the benefits of a visual, low‑code platform.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onewebstack.com/building-apps/integrations/develop-integration-with-oneweb-microflow/activity-nodes/java-task.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
