Menu

Home

jfaucher

BSF4Rexx version for ooRexx 4.1.0 and later, exploiting the new ooRexx kernel (e.g. allowing implementation of Java methods in ooRexx, callbacks from Java to ooRexx). [Camouflages Java as the dynamically typed, caseless and easy to use ooRexx.]


Project Members:


Discussion

  • Ruurd Idenburg

    Ruurd Idenburg - 2020-06-16

    Attached a first "proof of concept" to myself for bsf4ooRexx
    If one is interested in trying this, one should download the GraphHopper jar (graphhopper-web-1.0.jar) from: https://graphhopper.com/public/releases/graphhopper-web-1.0.jar and add the jar file to the CLASSPATH

    One should be able to invoke the attached rexx with 1 argument a country name in lowercase(e.g. netherlands or austria) for any other country one should adapt the "from" and "to" latitude/longitude pairs to specify locations within that country.

    The first time a country is processed to setup will take a long time (lots of minutes for bigger countries), subsequent invocations for that country will take most likely under 1 minute.

     
    • Per Olov Jonsson

      Dear Ruurd,

      Out of curiosity I wanted to try this out but immediately ran into problems with JAVA, it requires version 6 of JAVA, I have version 8. Also after installing JAVA 6 I could not make it run, here a short recap.

      po$ java -version
      java version "1.8.0_181"
      Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

      po$ rexx graphhopper
      No Java runtime present, requesting install.

      <installling java="" javaforosx,="" 6=""></installling>

      po$ /usr/bin/java -version
      java version "1.8.0_181"
      Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

      po$ echo $CLASSPATH
      /Users/po/Downloads

      po$ rexx graphhopper austria
      - Compiled routine "BsfLoadJava".
      - Compiled method "CALLWITH" with scope "Routine".
      821 - .routines["XBSFLOADJAVA"]~callWith(arr)
      145 - ::requires BSF.CLS -- loads Java support
      Error 40 running /Users/po/Downloads/graphhopper.REX line 145: Incorrect call to routine.
      Error 40.900: BSF4ooRexx/routine/BsfLoadJava(), error 5.994: initialization error, cannot find class 'org/rexxla/bsf/engines/rexx/Java4Rexx'.

      I have the latest bsf4ooRexx from 2020-04-24 and I am on macOS 10.13 (High Sierra). Please note that JAVA 6 may not work on macOS Mojave or Catalina (10.14 and 10.15 respectively). Any hints on what to to is welcome.

      PS I think this list is intended for discussions of the bsf4ooRexx Homepage, not discussions in general?

      Hälsningar/Regards/Grüsse,
      P.O. Jonsson
      oorexx@jonases.se

      Am 16.06.2020 um 22:11 schrieb Ruurd Idenburg idenburg@users.sourceforge.net:

      Attached a first "proof of concept" to myself for bsf4ooRexx
      If one is interested in trying this, one should download the GraphHopper jar (graphhopper-web-1.0.jar) from: https://graphhopper.com/public/releases/graphhopper-web-1.0.jar https://graphhopper.com/public/releases/graphhopper-web-1.0.jar and add the jar file to the CLASSPATH

      One should be able to invoke the attached rexx with 1 argument a country name in lowercase(e.g. netherlands or austria) for any other country one should adapt the "from" and "to" latitude/longitude pairs to specify locations within that country.

      The first time a country is processed to setup will take a long time (lots of minutes for bigger countries), subsequent invocations for that country will take most likely under 1 minute.

      Attachments:

      graphhopper.rex https://sourceforge.net/p/bsf4oorexx/wiki/_discuss/thread/14fc7e25/7277/attachment/graphhopper.rex (5.3 kB; application/x-rexx)
      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/bsf4oorexx/wiki/Home/ https://sourceforge.net/p/bsf4oorexx/wiki/Home/
      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/

       
      • Rony G. Flatscher

        Yes, please let us move this discussion to the support or developer list!

        @P.O.: There is no need to use Java 6, I just ran it with Java 8 on Windows. You seem to have no Java on that Mac installed as Apple originally prompted the user to install Apple's Java 6 which by now is not supported anymore. Also your CLASSPATH is not set up as a class from the BSF4ooRexx.jar package cannot be found. Are you sure that on that Mac you have properly installed Java and BSF4ooRexx?

        @Ruurd: running your script causes a runtime error. I slightly changed your script to get all Java exceptions printed that caused the Scripting error to be thrown.

        The causing Java exception is: [java.lang.IllegalStateException: Your specified OSM file does not exist:G:\test\bsf4oorexx\ruurd\ch-latest.osm.pbf]. This is the content of the directory:

         Directory of G:\test\bsf4oorexx\ruurd
        
        17.06.2020  09:45    <DIR>          .
        17.06.2020  09:45    <DIR>          ..
        17.06.2020  09:42    <DIR>          -gh-cache
        17.06.2020  09:45    <DIR>          at-gh-cache
        17.06.2020  09:51    <DIR>          ch-gh-cache
        22.05.2020  12:09        29 293 247 graphhopper-web-1.0.jar
        17.06.2020  09:41             5 304 graphhopper.rex
        17.06.2020  09:51             5 530 graphhopper2.rex
        17.06.2020  09:42    <DIR>          srtmgl1
        17.06.2020  09:45    <DIR>          us-gh-cache
        

        This is the extended error message from the edited script:

        G:\test\bsf4oorexx\ruurd>rexx graphhopper2.rex ch
        09:51:53.279 [main] DEBUG org.apache.bsf.BSFManager - BSFManager:loadScriptingEngine
        09:51:53.286 [main] DEBUG org.apache.bsf.BSFManager - BSFManager:getClassPath
        09:51:53.286 [main] DEBUG org.apache.bsf.BSFManager - BSFManager:getClassLoader
        $CLASSPATH
        C:\Program Files (x86)\BSF4ooRexx\bsf4ooRexx-v641-20200130-bin.jar;C:\Program Files (x86)\BSF4ooRexx\jni4net.j-0.8.8.0.jar;C:\Program Files (x86)\BSF4ooRexx\oorexx.net.jar;.;C:\Program Files (x86)\OpenOffice 4\program\;C:\Program Files (x86)\OpenOffice 4\program\classes\unoil.jar;C:\Program Files (x86)\OpenOffice 4\program\classes\ridl.jar;C:\Program Files (x86)\OpenOffice 4\program\classes\jurt.jar;C:\Program Files (x86)\OpenOffice 4\program\classes\juh.jar;G:\test\bsf4oorexx\ruurd\graphhopper-web-1.0.jar
        
        
        09:51:53.534 [main] INFO com.graphhopper.reader.dem.SRTMGL1Provider - srtmgl1 Elevation Provider, from: https://cloud.sdsc.edu/v1/AUTH_
        opentopography/Raster/SRTM_GL1/SRTM_GL1_srtm/, to: G:\test\bsf4oorexx\ruurd\srtmgl1, as: MMAP_STORE using interpolate: true
        Testing SRTMGL1 elevation provider: 1928.7241135999284
        name=car|vehicle=car|weighting=fastest|turnCosts=false|hints={}
        name=bike|vehicle=bike|weighting=fastest|turnCosts=false|hints={}
        ---> hopper=[com.graphhopper.reader.osm.GraphHopperOSM@c3fd8b] ~toString=[com.graphhopper.reader.osm.GraphHopperOSM@c3fd8b]
        09:51:53.591 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - version 1.0|2020-05-22T12:08:02Z (5,15,4,3,5,6)
        09:51:53.595 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - graph CH|car,bike|RAM_STORE|3D|no_turn_cost|,,,,, details:edges:0(0MB), nodes:0(0MB), name:(0MB), geo:0(0MB), bounds:1.7976931348623157E308,-1.7976931348623157E308,1.7976931348623157E308,-1.7976931348623157E308,1.7976931348623157E308,-1.7976931348623157E308, CHGraph|car|NODE_BASED, shortcuts:0, nodesCH:(0MB), CHGraph|bike|NODE_BASED,shortcuts:0, nodesCH:(0MB)
        09:51:53.611 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - start creating graph from ch-latest.osm.pbf
        09:51:53.613 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - using CH|car,bike|RAM_STORE|3D|no_turn_cost|,,,,, memory:totalMB:15, usedMB:4
                [ADDITIONAL] =[an Array (2 items) id#_-51181969]
                        ["BSF4ooRexx/routine/BSF(), error 3: Java exception occurred: [org.apache.bsf.BSFException: BSF4ooRexx subfunction ""invoke"": " || "0A09"x || "bean:        [com.graphhopper.reader.osm.GraphHopperOSM@c3fd8b] --> type: <com.graphhopper.reader.osm.GraphHopperOSM>" || "0A09"x || "method:      [IMPORTORLOAD] not found or execution error!" || "0A0A09"x || "-> check method name=[IMPORTORLOAD] (caseless o.k., but correct spelling?)" || "0A"x || "]"]
                        [org.apache.bsf.BSFException@18067a5 id#_-51179953]
                                --> exception: [org.apache.bsf.BSFException@18067a5 id#_-51179953]
                                --> caused by: [java.lang.IllegalStateException: Your specified OSM file does not exist:G:\test\bsf4oorexx\ruurd\ch-latest.osm.pbf]
                [CODE]       =[40.900]
                [CONDITION]  =[SYNTAX]
                [DESCRIPTION]=[]
                [ERRORTEXT]  =[Incorrect call to routine.]
                [INSTRUCTION]=[SIGNAL]
                [MESSAGE]    =["BSF4ooRexx/routine/BSF(), error 3: Java exception occurred: [org.apache.bsf.BSFException: BSF4ooRexx subfunction ""invoke"": " || "0A09"x || "bean:        [com.graphhopper.reader.osm.GraphHopperOSM@c3fd8b] --> type: <com.graphhopper.reader.osm.GraphHopperOSM>" || "0A09"x || "method:      [IMPORTORLOAD] not found or execution error!" || "0A0A09"x || "-> check method name=[IMPORTORLOAD] (caseless o.k., but correct spelling?)" || "0A"x || "]."]
                [PACKAGE]    =[a Package id#_-47049121]
                [POSITION]   =[90]
                [PROGRAM]    =[G:\test\bsf4oorexx\ruurd\graphhopper2.rex]
                [PROPAGATED] =[1]
                [RC]         =[40]
                [STACKFRAMES]=[a List (4 items) id#_-51184273]
                        [       *-* Compiled routine "BSF". id#_-51185185]
                        [       *-* Compiled method "CALLWITH" with scope "Routine". id#_-51185865]
                        [  1905 *-* return bsf.wrap(self~class~rBSF~callWith(arr))   -- process result and return it id#_-51186385]
                        [    90 *-* hopper~importOrLoad id#_-51186673]
                [TRACEBACK]  =[a List (4 items) id#_-51184433]
                        [       *-* Compiled routine "BSF".]
                        [       *-* Compiled method "CALLWITH" with scope "Routine".]
                        [  1905 *-* return bsf.wrap(self~class~rBSF~callWith(arr))   -- process result and return it]
                        [    90 *-* hopper~importOrLoad]
        
        
        G:\test\bsf4oorexx\ruurd>
        

        Again, please let us continue on the support mailing list.

         
        • Per Olov Jonsson

          Dear Rony,

          Am 17.06.2020 um 10:03 schrieb Rony G. Flatscher orexx@users.sourceforge.net:

          Yes, please let us move this discussion to the support or developer list!

          If you move the discussion I will follow.

          @P.O.: There is no need to use Java 6, I just ran it with Java 8 on Windows. You seem to have no Java on that Mac installed as Apple originally prompted the user to install Apple's Java 6 which by now is not supported anymore. Also your CLASSPATH is not set up as a class from the BSF4ooRexx.jar package cannot be found. Are you sure that on that Mac you have properly installed Java and BSF4ooRexx?

          The installation of JAVA 6 was not my idea :-( the request to install Java 6 arises as soon as I try to run the program, the program does not launch before Java 6 is installed. And after the installation the program fail to run as described below. I think we had this discussion/problem in the past with a Java installation that it is not possible to get past.

          I have Java 8 installed and automatically updated, let me know what command besides java -version to use to find out what is missing.

          I took the latest bsf4ooRexx installer from Sourceforge today, there is no conflict with other ooRexx installations, I have checked.

          I have defined the classpath in the same way as the path, in ,bash_profile and It points to ~/Downloads, where I have put the jar file and the rexx program, as per the instruction.

          <snip></snip>

          Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/bsf4oorexx/wiki/Home/ https://sourceforge.net/p/bsf4oorexx/wiki/Home/
          To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/

           
          • Ruurd Idenburg

            Ruurd Idenburg - 2020-06-17

            Hi PO

            I cannot append the the ticket page on sourceforge for some reason.

            I have not found any reason why GraphHopper would want to use Java 6 on
            Mac OS.

            In case you have solved that problem before trying to run my very simple
            script( which just tries to use the GraphHopper routing engine to
            rretrieve textual turn directions ) you should take care of the
            following things:

            1 GraphHopper uses Open Street Map files for its routing engine, so my
            script needs thos as well and nobody else but has those lying around on
            their system I guess. So please add the following snippet just after the
            "echo $CLASSPATH" and those files will be downloaded for you (if MacOS
            has "wget" that is):


            -- Determine the OSM file we need
            osmFile = country"-latest.osm.pbf"
            osmWeb = "http://download.geofabrik.de/europe/"
            if \SysFileExists(osmFile) then do
              say "OpenStreetMap file:" osmFile "does not exist going to download
            it from:" osmWeb
              "wget -S -nv -O" osmFile osmWeb||osmFile
            end


            1. For the initial set up you need to set the JAVA allowed maximum
              (|-Xmx128m)| to certainly 2GB for countries like austria and denmark and
              probably much higher for the bigger ones like Spain and France.

            2. Don't forget this is just a "proof-of-concept" for me to establish if
              I can use bsf4ooRexx in a more useful way than just showing some fancy
              windows.

            Greetz,

            Ruurd

             
            • Per Olov Jonsson

              Von meinem iPhone gesendet

              Am 17.06.2020 um 20:50 schrieb Ruurd Idenburg idenburg@users.sourceforge.net:

              
              Hi PO

              I cannot append the the ticket page on sourceforge for some reason.

              I think you need to be logged in.

              Consider signing up for (all) mailing lists, valuable info. Rony already gave some hints.

              I have not found any reason why GraphHopper would want to use Java 6 on
              Mac OS.

              This is a macOS thing, I have version 8 installed. For some reason macOS fail to detect the JAVA installation and launches this request. I have solved it now.

              In case you have solved that problem before trying to run my very simple
              script( which just tries to use the GraphHopper routing engine to
              rretrieve textual turn directions ) you should take care of the
              following things:

              1 GraphHopper uses Open Street Map files for its routing engine, so my
              script needs thos as well and nobody else but has those lying around on
              their system I guess. So please add the following snippet just after the
              "echo $CLASSPATH" and those files will be downloaded for you (if MacOS
              has "wget" that is):

              -- Determine the OSM file we need
              osmFile = country"-latest.osm.pbf"
              osmWeb = "http://download.geofabrik.de/europe/"
              if \SysFileExists(osmFile) then do
              say "OpenStreetMap file:" osmFile "does not exist going to download
              it from:" osmWeb
              "wget -S -nv -O" osmFile osmWeb||osmFile
              end

              Will give it a try manâna.

              For the initial set up you need to set the JAVA allowed maximum
              (|-Xmx128m)| to certainly 2GB for countries like austria and denmark and
              probably much higher for the bigger ones like Spain and France.

              Don't forget this is just a "proof-of-concept" for me to establish if
              I can use bsf4ooRexx in a more useful way than just showing some fancy
              windows.

              Greetz,

              Ruurd

              Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/bsf4oorexx/wiki/Home/

              To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

               
  • Ruurd Idenburg

    Ruurd Idenburg - 2020-06-17

    Hi PO,

    I'm running Linux Mint19.3 (Ubuntu 18.04):

    ruurd@Paradigit2:~/Rexx$ java -version
    openjdk version "11.0.7" 2020-04-14
    OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
    OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)
    ruurd@Paradigit2:~/Rexx$ uname -a
    Linux Paradigit2 5.3.0-59-generic #53~18.04.1-Ubuntu SMP Thu Jun 4 14:58:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

    Maybe GraphHopper requires Java 6 on MacOS, but certainly not on Linux Mint, I'll see if I can find out and you're prbably right about the purpos of this page, I guess we should move to the discussions page.

    Greetz,

    Ruurd

     
  • Ruurd Idenburg

    Ruurd Idenburg - 2020-06-17

    Oops didn't see Rony's response in time, yeah let's move.

    Ruurd

     

Log in to post a comment.