diff --git a/modules/java/test/pure_test/build.xml b/modules/java/test/pure_test/build.xml
index e9b57fe34d..15419f5d67 100644
--- a/modules/java/test/pure_test/build.xml
+++ b/modules/java/test/pure_test/build.xml
@@ -4,6 +4,9 @@
+
+
+
@@ -38,7 +41,7 @@
-
+
@@ -50,7 +53,7 @@
-
+
diff --git a/modules/ts/misc/run.py b/modules/ts/misc/run.py
index 29c0aa6b90..2d5de0708c 100755
--- a/modules/ts/misc/run.py
+++ b/modules/ts/misc/run.py
@@ -50,7 +50,7 @@ if __name__ == "__main__":
parser.add_argument("--android_env", action='append', help="Android: add environment variable (NAME=VALUE)")
parser.add_argument("--android_propagate_opencv_env", action="store_true", default=False, help="Android: propagate OPENCV* environment variables")
parser.add_argument("--serial", metavar="serial number", default="", help="Android: directs command to the USB device or emulator with the given serial number")
- parser.add_argument("--package", metavar="package", default="", help="Android: run jUnit tests for specified package")
+ parser.add_argument("--package", metavar="package", default="", help="Java: run JUnit tests for specified module or Android package")
parser.add_argument("--trace", action="store_true", default=False, help="Trace: enable OpenCV tracing")
parser.add_argument("--trace_dump", metavar="trace_dump", default=-1, help="Trace: dump highlight calls (specify max entries count, 0 - dump all)")
diff --git a/modules/ts/misc/run_suite.py b/modules/ts/misc/run_suite.py
index a3c4be7546..0420d9a968 100644
--- a/modules/ts/misc/run_suite.py
+++ b/modules/ts/misc/run_suite.py
@@ -112,7 +112,10 @@ class TestSuite(object):
args = args[:]
exe = os.path.abspath(path)
if module == "java":
- cmd = [self.cache.ant_executable, "-Dopencv.build.type=%s" % self.cache.build_type, "buildAndTest"]
+ cmd = [self.cache.ant_executable, "-Dopencv.build.type=%s" % self.cache.build_type]
+ if self.options.package:
+ cmd += ["-Dopencv.test.package=%s" % self.options.package]
+ cmd += ["buildAndTest"]
ret = execute(cmd, cwd=self.cache.java_test_dir)
return None, ret
elif module in ['python2', 'python3']: