From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id 4C025385740D for ; Thu, 5 Aug 2021 15:55:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4C025385740D Received: by mail-lf1-x12b.google.com with SMTP id b6so12007951lff.10 for ; Thu, 05 Aug 2021 08:55:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JyTVR4mOJvsbdNltlblDaM4inzUFT1GTla8l7Wc58zs=; b=DUtIiA23gBfHSR15CKY8Q/ditSNpAudugkSrFKExxe+2tXddDj7tLnajzU8SWclzaV ypRMhT1EW12l0rNW2su0nEeEnTqE3YzFmPfJK3gd13xWOpMx0AoSa9YKaujuOoVtK0cf mk5CKCXm9w6e9LufMPnEqBmQgE1sSNc/8NdqlzWqWsuCATp7gQns1PVbnAv48q4CBM36 hW5m6kOMePP2yTIbtgvoW5K9in99A0niddHoT+KRzE34bMQPX7Phst11xknqhQNQ0Nj0 9VDOymmCyztS9KG0O5Ua9D/V1buF4XcWYxpbf8E2do6a+VvGVZmGNt9BDT2Pol25O3k2 wYrQ== X-Gm-Message-State: AOAM533gmHa7MLnAOHbupOCpH85rAMLacw+LPaec7JUWTW64nwVYm4NU kTlkBNewNtVB0DGZ1SBFXSXLHWJJS58l33FYvlI= X-Google-Smtp-Source: ABdhPJytpFe2WxuIritGl4QKgUYjPzVdEWsb/KgDNpIAnvhgfXE5y08CJreQ2l3NA8Ls31f4d7HWMJaxLh1q4nNtmis= X-Received: by 2002:a05:6512:401a:: with SMTP id br26mr4298304lfb.236.1628178905085; Thu, 05 Aug 2021 08:55:05 -0700 (PDT) MIME-Version: 1.0 References: <87zgtwv42v.fsf@L440.i-did-not-set--mail-host-address--so-tickle-me> In-Reply-To: From: Arvydas Silanskas Date: Thu, 5 Aug 2021 18:54:52 +0300 Message-ID: Subject: Re: Example of importing a jar (from ~/.m2/repository) To: Phil Eaton Cc: Alcides Flores Pineda , kawa mailing list X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FREEMAIL_REPLY, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:55:11 -0000 Hello, You should use `:` as a classpath separator on linux, not `;`. Arvydas 2021-08-05, kt, 17:02 Phil Eaton ra=C5=A1=C4=97: > Hey Alcides! > > Thanks for the response. Why do I need to _both_ cp or symlink a jar into > $HOME/lib and also set -classpath? Why can't I leave it in its current > place and just set -classpath? > > Also, I already set $CLASSPATH to the location of the jar. Isn't that the > same thing as setting -classpath? > > Thanks! > Phil > > On Thu, Aug 5, 2021 at 1:43 AM Alcides Flores Pineda > > wrote: > > > Hi Phil: > > > > If you are just running Kawa from the command line and all that you wan= t > > is to use/test some library (from a local Maven repository or not) in t= he > > Kawa REPL, then you can just copy or symlink all the needed JAR files, > > (including `kawa.jar`) into a specific directory, and then tell java to > > run them from there. > > > > For example, suppose I want to use the Apache Commons Codec > > library from my local Maven repo ($HOME/.m2/repository) in a Kawa REPL, > > then, what I do is the following: > > > > 1. I copy or symlink the required file along with `kawa.jar`) > > > > > ($HOME/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10= .jar) > > into a directory (say for example $HOME/lib). > > > > 2. From there run as: > > cd $HOME/lib > > java -cp $HOME/lib/commons-codec-1.10.jar:$HOME/lib/kawa.jar kawa.repl > > > > 3. Now I can use the DigestUtils class from the Kawa repl as: > > #|kawa:1|# (import (class org.apache.commons.codec.digest DigestUtils)) > > #|kawa:2|# (DigestUtils:md5-hex "mystring") > > 169319501261c644a58610f967e8f9d0 > > > > The same stuff applies if you want to run/use it from a Kawa scheme > script. > > > > On the other side, if you need/want to use more than a library/JAR (say > > a framework like Spring) with Kawa in a Maven project and run it from > > there, then I suggest you to do the following: > > > > 1. Use the Kawa Maven plugin that Arvydas wrote last year to compile > > your Kawa scheme files: > > * https://github.com/arvyy/kawa-maven-plugin > > > > 2. Configure your POM (pom.xml) in such a way that it uses the desired > > libraries/dependencies and the `kawa.jar` to compile and run your Ka= wa > > scheme > > files, for example with the Maven Ant-Run plugin and the Exec Maven > > plugin. > > > > > > Greetings. > > -- > > Alcides Flores Pineda. > > > > > > El mi=C3=A9, ago 04 2021, Phil Eaton escribi=C3=B3: > > > > > Hey folks, > > > > > > New to Java and Kawa. I'm trying to import a web server library that = I > > > installed through maven. > > > > > > The minimal program I'm running is this (test.scm): > > > > > > (import (class io.jooby Context)) > > > > > > > > > And I run it by making all maven jars available in the CLASSPATH: > > > > > > CLASSPATH=3D"$(find ~/.m2/repository -name '*.jar' | paste -sd ';');.= " > kawa > > > test.scm > > > > > > > > > But I get: > > > > > > test.scm:2:16: no class found named io.jooby.Context > > > > > > > > > The io.jooby:jooby jar is > > > at ~/.m2/repository/io/jooby/jooby/2.10.0/jooby-2.10.0.jar. > > > > > > What more should I do for Kawa to find the class? > > > > > > Thanks! > > > Phil > > > > >