I’m trying to use processing in eclipse, and am getting an error. After making my main class extend PApplet, regardless of whether I change anything else or not, I get:
“Exception in thread “main” java.lang.ExceptionInInitializerError
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 2
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
at java.base/java.lang.String.substring(String.java:1874)
at processing.core.PApplet.(PApplet.java:123)”
I think this is caused by a static variable somewhere? I’m running on Xubuntu, with java-11-openjdk-amd64, please advise.
Java 9+ does cause problems and break some aspects of backwards compatibility. I wouldn’t try and use Processing for anything useful with it yet. Not supporting anything other than 8 I get.
However, fixing the issue that cause this specific exception should be done in my opinion so that people can at least test it and report issues. Not fixing it is short sighted.
I would have to install it, and keep it from conflicting with other stuff, and get eclipse to acknowledge and use it. Possible, but a bit of a pain. -_-
You say that, but now I’m getting an entirely new set of weird errors. -_-
Edit: Like, Eclipse insists on putting the new JRE under the classpath, not the modulepath, and then complains about the code having been compiled with a newer version of the JRE, and refuses to let me recompile.
I’m using OpenJDK 10 (the latest available in ArchLinux atm) for my current project and it works fine. I even tried mixing it with Kotlin files and that worked too.
I have just released a pre-release version of propane targetting java-11, that compiles and runs fine on Mint linux. I would love for someone to test it on Windows and MacOS. Currently FX2D is unsupported (doesn’t come included with java-11) but otherwise it just seems to work.
I’m able to use Processing in eclipse on Mac with the built-in Java 10 and compile with no issues.
. When I specify a Java 8 target but do not include Java 8 as a local resource then Eclipse lists a warning in Problems:
Build path specifies execution environment JavaSE-1.8. There are no JREs installed in the workspace that are strictly compatible with this environment.
…but the editor and Ant build processing works fine – I have never encountered any actual “problems”.
What not-macOS operating system are you using? Windows x? Some version of Linux?
Which version of Java / JDK do you have installed, and did you install one specifically in that project workspace or are you just using your system Java?
I’m using macOS. I actually finally got it to work by installing JDK 8 and then following this video to get eclipse to see the JDK installation, for some reason even though it was installed it wasn’t showing up properly in the list of JDKs https://www.youtube.com/watch?v=whQaqnI4SrU
It would be helpful for new users if that tutorial was updated as it really isn’t accurate
Glad you got it working with Java 8 – That is what works for me as well. It sounds like you just found the latest changes that should be made to the tutorial – would you click on the “please let us know” link at the topic of the tutorial page and submit your recommended updates?