EXCEPTION_ACCESS_VIOLATION in org.fusesource.jansi when starting via *.cmd script on windows
Issue #7
resolved
We have a cmd-script that starts our .jar file. Starting the script fails, when using an ArgsParser(), since it leads to an EXCEPTION_ACCESS_VIOLATION when trying to determine the terminal width. The following code is enough to reproduce the issue:
public static void main(String... args) {
ArgsParserProperties parser = new ArgsParserProperties();
System.out.println("Test was successful!");
}
I build this into a test.jar. If I start it via java -jar on the powershell, everything works just fine. However, using the script test-execute.cmd (see attached) it fails.
start "test" "%LATESTJAVA%" -Dfile.encoding=UTF-8 -XX:+UseG1GC -XX:+UseStringDeduplication -jar "test.jar" %*
Unfortunately, adjusting the script is not an option, since that would require our customers to reinstall the software.
I attached the following:
- a log file that is generated when the script is executed
- a test.jar that reproduces the issue
- the corresponding cmd-script
Comments (2)
-
-
- changed status to resolved
Fixed with release
3.2.6
. - Log in to comment
At first sight it looks as if the the issue is caused by Jansi (as of https://github.com/fusesource/jansi/issues/216)..) Jansi seems to crash when run with
javaw
(aka without a Terminal). Preventing the use of Jansi when starting the application withjavaw
(System.console()
should benull
in such a case) may solve the problem. The most current3.2.6-SNAPSHOT
of this artifact has the workaround included: Jansi will not be used in caseSystem.console() == null
: Can be tested in3.2.6-SNAPSHOT
(you may have to temporarily add the Sonatype snapshots repository https://oss.sonatype.org/content/repositories/snapshots to your build configuration if you do not want to wait for the3.2.6
final release).