在Geany中导入外部jar [英] importing external jar in Geany

查看:73
本文介绍了在Geany中导入外部jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在导入jar文件并在 Geany IDE 中运行时遇到问题.这是我的工作: 我已经下载了 Jsoup .提取它并将org文件放在我的项目目录中.然后将其导入我的源代码:

I have problem with importing jar file and running in Geany IDE. This is what I do: I have downloaded Jsoup. Extracted it and placed org file in my project directory. Then imported it to my source code:

    import org.jsoup.*;// why this does not import all
/*
instead I need to import everything manually
import org.jsoup.Jsoup;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
*/

        public class Crawler {

            public static void main (String args[]) {
                String html = "<html><head><title>First parse</title></head>"
          + "<body><p>Parsed HTML into a doc.</p></body></html>";
                Document doc = Jsoup.parse(html);
            }
        }

当我尝试在Geany中进行编译时,它给了我错误:

When I tried to compile it within Geany it gave me error:

Crawler.java:7: cannot find symbol
symbol  : class Document
symbol  : class Document
symbol  : class Document

我做错了,如何解决?

推荐答案

下载jar文件并将external jar放置在某些\lib目录中,并将其添加到项目的类路径中.好的做法是,使用org.jsoup.Document

Download the jar file and place the external jar in some \lib directory and add it to your project's classpath. As a good practice, instead of wildcard imports org.jsoup.* use org.jsoup.Document

这篇关于在Geany中导入外部jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆