---
title: "Java Request"
description: "Configure the JMeter Java Request samplers: properties, defaults, and practical usage notes for building reliable load tests."
url: https://docs.jmeter.ai/components/java-request/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# Java Request

*Part of the **Samplers** category. Also documented in context in the [full Component Reference](/user-manual/component-reference/#java-request).*

![Java Request](/images/screenshots/java_request.png)

This sampler lets you control a java class that implements the
`org.apache.jmeter.protocol.java.sampler.JavaSamplerClient` interface.
By writing your own implementation of this interface,
you can use JMeter to harness multiple threads, input parameter control, and
data collection.

The pull-down menu provides the list of all such implementations found by
JMeter in its classpath.  The parameters can then be specified in the
table below - as defined by your implementation.  Two simple examples (`JavaTest` and `SleepTest`) are provided.

The `JavaTest` example sampler can be useful for checking test plans, because it allows one to set
values in almost all the fields. These can then be used by Assertions, etc.
The fields allow variables to be used, so the values of these can readily be seen.

> **Note**
> If the method `teardownTest` is not overridden by a subclass of `[AbstractJavaSamplerClient](https://jmeter.apache.org/api/org/apache/jmeter/protocol/java/sampler/AbstractJavaSamplerClient.html)`, its `teardownTest` method will not be called.
> This reduces JMeter memory requirements.
> This will not have any impact on existing Test plans.

> **Note**
> The Add/Delete buttons don’t serve any purpose at present.

| Name | Required | Description |
| --- | --- | --- |
| Name | No | Descriptive name for this sampler          that is shown in the tree. |
| Classname | Yes | The specific implementation of         the JavaSamplerClient interface to be sampled. |
| Send Parameters with Request | No | A list of         arguments that will be passed to the sampled class.  All arguments         are sent as Strings. See below for specific settings. |

The following parameters apply to the `SleepTest` and `JavaTest` implementations:

| Name | Required | Description |
| --- | --- | --- |
| Sleep_time | Yes | How long to sleep for (ms) |
| Sleep_mask | Yes | How much “randomness” to add:             The sleep time is calculated as follows:              `totalSleepTime = SleepTime + (System.currentTimeMillis() % SleepMask)` |

The following parameters apply additionally to the `JavaTest` implementation:

| Name | Required | Description |
| --- | --- | --- |
| Label | No | The label to use. If provided, overrides `Name` |
| ResponseCode | No | If provided, sets the SampleResult ResponseCode. |
| ResponseMessage | No | If provided, sets the SampleResult ResponseMessage. |
| Status | No | If provided, sets the SampleResult Status. If this equals “`OK`” (ignoring case) then the status is set to success, otherwise the sample is marked as failed. |
| SamplerData | No | If provided, sets the SampleResult SamplerData. |
| ResultData | No | If provided, sets the SampleResult ResultData. |

## Related

- [API Load Testing Guide](/topics/api-load-testing/)
- [cURL & HAR to JMX Converter](/tools/curl-to-jmx/)
- [Full Component Reference](/user-manual/component-reference/)
- [Functions and Variables](/user-manual/functions/)
