Skip to content

Commit 37462c8

Browse files
committed
improve error message
1 parent 9332b2e commit 37462c8

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

py5_resources/py5_module/py5/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,16 @@
128128
print(debug_info, file=sys.stderr)
129129
raise RuntimeError("py5 is unable to start Java 17 Virtual Machine")
130130

131-
if JClass("py5.util.CheckHeadless")().test():
131+
try:
132+
if JClass("py5.util.CheckHeadless")().test():
133+
raise RuntimeError(
134+
"py5 is unable to run correctly in headless mode. "
135+
"Make sure you are running in a graphical environment and that your Java Virtual Machine is not a Headless JVM."
136+
)
137+
except:
132138
raise RuntimeError(
133-
"py5 is unable to run correctly in headless mode. Make sure you are running in a graphical environment and that your Java Virtual Machine is not a Headless JVM."
139+
"Unable to instantiate Java class py5.util.CheckHeadless. "
140+
"If you are using PyInstaller right now, please check that all of py5's jar files are included in your package."
134141
)
135142

136143
import py5_tools.colors.css4 as css4_colors # noqa

0 commit comments

Comments
 (0)