ropensci / opentripplanner

An R package to set up and use OpenTripPlanner (OTP) as a local or remote multimodal trip planner.
https://docs.ropensci.org/opentripplanner
GNU General Public License v3.0
80 stars 20 forks source link

[BUG] Error message with Java 19 #112

Open Robinlovelace opened 11 months ago

Robinlovelace commented 11 months ago

Describe the bug

The following code generates an error:

library(opentripplanner)
# Path to a folder containing the OTP.jar file, change to where you saved the file.
path_data <- file.path(tempdir(), "OTP")
dir.create(path_data)
path_otp <- otp_dl_jar(version = "2.2.0")
otp_dl_demo(path_data)
# Build Graph and start OTP
log1 <- otp_build_graph(otp = path_otp, dir = path_data)

From: https://docs.ropensci.org/opentripplanner/articles/OTPv2.html

The error message is:

In otp_check_java(otp_version = otp_version) :
  OTP 2.2+ requires Java version 17 you have version 19

To Reproduce

See above.

Expected behavior

I think Java 17 should be the minimum and it should at least try to run. Screenshots If applicable, add screenshots to help explain your problem.

System Please paste sessionInfo() here:

Additional context Add any other context about the problem here.

Robinlovelace commented 11 months ago

Attempting the following fix:

sudo apt install openjdk-17-jdk
# Set the version of Java to use:
sudo update-alternatives --config java

Will select 2:

sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                         Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-19-openjdk-amd64/bin/java   1911      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      manual mode
  2            /usr/lib/jvm/java-17-openjdk-amd64/bin/java   1711      manual mode
  3            /usr/lib/jvm/java-19-openjdk-amd64/bin/java   1911      manual mode
Robinlovelace commented 11 months ago

That worked! My guess: it would also work with Java 19 if we gave it a chance.

mem48 commented 10 months ago

Your probably right, OTP now seems to be racing through Java versions very quickly. Its a pain to keep up.