GithubHelp home page GithubHelp logo

Add jars via classpath about almond HOT 8 CLOSED

almond-sh avatar almond-sh commented on August 22, 2024
Add jars via classpath

from almond.

Comments (8)

alexarchambault avatar alexarchambault commented on August 22, 2024

Yep, sorry, it should land here. That's like

classpath.addPath("/path/to/file.jar")

from almond.

Atry avatar Atry commented on August 22, 2024

It does not work now

cmd2.sc:1: not found: value classpath
val res2 = classpath.addPath("/path/to/file.jar")
           ^

from almond.

Atry avatar Atry commented on August 22, 2024

interp.load.cp is available. However it is not able to add a JAR from http URL.

from almond.

animeshsrivastava24 avatar animeshsrivastava24 commented on August 22, 2024

If you want to add a local jar to Jupyter Scala , follow the instructions :

  1. Create a jar file for your project work
  2. Find the path to the jar
  3. Go to Jupyter Scala cell and type all the instructions in a single cell or split them in different cells as per your convenience

import ammonite., ammonite.ops.

val path = java.nio.file.FileSystems.getDefault().getPath("/home/animesh/Bureau/lastest_n2s3/out/artifacts/root_jar/root.jar") // here inside the " " add your path, I have added mine for example

val x = ammonite.ops.Path(path)

interp.load.cp(x)

It works for me, please check for yourself.

from almond.

Atry avatar Atry commented on August 22, 2024

I created an sbt plug-in for exporting classpath for Ammonite and Jupyter Scala

https://github.com/ThoughtWorksInc/sbt-ammonite-classpath/

from almond.

sunbuhui avatar sunbuhui commented on August 22, 2024

If someone used @animeshsrivastava24 code above and encountered compilation failed error below.
image
just comment frist line β€˜import ammonite., ammonite.ops.’
image
Then it should work

from almond.

animeshsrivastava24 avatar animeshsrivastava24 commented on August 22, 2024

@key2Love Can you explain how are you getting the value of x without importing the libraries?
Did you read your error code of twice import?

from almond.

sunbuhui avatar sunbuhui commented on August 22, 2024

@animeshsrivastava24 I didn't import the libraries before, it seems that almond imports these libraries automatically. I test this by restarting the kernel, the console still reported twice report error.

from almond.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.