Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIndexOutOfBoundsException on Windows 10 #86

Open
jefft0 opened this issue Oct 6, 2019 · 0 comments
Open

StringIndexOutOfBoundsException on Windows 10 #86

jefft0 opened this issue Oct 6, 2019 · 0 comments
Assignees

Comments

@jefft0
Copy link

jefft0 commented Oct 6, 2019

On Windows 10 with openjdk 11, running any of the applications gives the error:

StringIndexOutOfBoundsException: begin 0, end 3, length 2

This comes from a known bug inside the library code for PApplet at this line:

javaVersion = new Float(javaVersionName.substring(0, 3));

It expects the system property "java.version" to be at least length 3, for example "11.0". But in this version of openjdk it is actually something like "11".

A solution: At the beginning of the main() method for any application that uses PApplet, add:

if (System.getProperty("java.version").length() < 3)
  System.setProperty("java.version", System.getProperty("java.version") + ".0");

More details are here: processing/processing#5275

@PtrMan PtrMan self-assigned this Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants