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
I think this is caused by a static variable somewhere? I’m running on Xubuntu, with java-11-openjdk-amd64, please advise.
You need to use Java 8. See https://github.com/processing/processing/issues/5602
And there isn’t a released Apache NetBeans that fully supports Java 11 yet either.
Whoops, I meant eclipse. As for the error, any idea when it will be fixed? It seems like a silly problem to have.
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.
At the very least it should have it’s own dedicated error message, so people know what’s going on and how to fix it.
Not quite sure how that would work, and the latest release of Processing is older than Java 11.
What’s your issue with using Java 8 for now anyway?
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. -_-
It’s not that difficult. And personally I’d recommend 8 as default for anything useful, 11 for testing purposes only, for a good few months yet.
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.
Oh hey, I finally got it to work. No idea what I did, though.
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”.
Is it possible to have an explanation of exactly how you got processing to work on eclipse? It’s not very clear how this can be done. The tutorial for eclipse appears to use macOS but doesn’t have the issues I am facing. https://processing.org/tutorials/eclipse/ which are similar to this thread: https://stackoverflow.com/questions/47343612/cannot-compile-when-importing-processing-library-into-eclipse/48292239#48292239
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?