简体   繁体   中英

How can I use external libraries with the scripts atom package and java?

How do I go about configuring the classpath when using the scripts package with atom/java?

I know my classpath is:

usr/local/algs4/algs4.jar

Here is the code I am testing with:

import edu.princeton.cs.algs4.*;

public class Wget {

public static void main(String[] args) {

    // read in data from URL
    String url = args[0];
    In in = new In(url);
    String data = in.readAll();

    // write data to a file
    String filename = url.substring(url.lastIndexOf('/') + 1);
    Out out = new Out(filename);
    out.println(data);
    out.close();
}

}

Since you're using algs4, Use Princeton's site and search for classpath. http://algs4.cs.princeton.edu/code/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM