Hi, I compile JOSM from the SVN sources with ant (ant clean dist
) and that used to work for years. But now I get compile errors, the first one is:
[javac] /josm/josm/core/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTile.java:58: error: <identifier> expected
[javac] try (protoBufRecord; // Cleanup bytes
I tried with openJDK 8 and 17. Latest SVN revision (19301) and latest stable (19277). Any idea what the problem might be?
Both r19301 and r19277? AFAIK, there shouldn’t be anything that changed that would kill javac, especially since JOSM [Jenkins] and GitHub Actions are properly building (except on Windows, but that seems to be a test failure).
Does mvn package
work? Do you have any local modifications?
EDIT: What platform are you on? What are the ant/maven versions?
Also, JOSM is now Java 11+, not Java 8+ (as of r19044). That might have been the problem for the snippet you posted – that particular location uses a newer syntax for try-with-resources that doesn’t require variable assignment (just that the variable be effectively final).
I think the SVN version is not the issue, looks like a general problem. I do not have nvm installed, is it needed to build JOSM? I have no local modifications and I tried with a fresh checkout, same error. I’m on Linux, openSuSE Leap 15.5. ant is Apache Ant™ version 1.10.14. javac is version 17.0.13. I remember that Java 1.8 was used for a long time and then there was an update to a more recent version, but I don’t remember which version that was. The last compile that worked was with Java 11.0.24 from Oracle on a different machine. Do we have an overview what Java JDK versions are supported?
mvn
is not needed to build JOSM right now; it is just a different option (for now).
As far as what Java JDK versions are supported:
- Vendors
- Oracle
- Temurin
- OpenJDK
- Azul
- Bellsoft
- Versions
- 11
- 17
- 21
- latest (currently 23, IIRC)
I can build on macOS with Temurin 11, 17, 21, and 24. Your ant
version should be new enough.
Try setting JAVA_HOME
to Java 11 or greater. What are the error messages that you get when compiling with Java 11+? There is a Hide details
option for these posts (under the gear icon).
1 Like
Thanks for mentioning JAVA_HOME, with that I figured it out: Initially there was no javac in a version newer than 1.8. There is no openjdk-devel for version 17 in the package GUI (YaST), but it can be installed from the command line (zypper install java-17-openjdk-devel
). With that I got a javac in version 17, but JAVA_HOME was still set to version 1.8. Setting JAVA_HOME to version 17 fixed the issue, it compiles now.
3 Likes