你如何使用Java库? [英] How do you use a Java Library?

查看:107
本文介绍了你如何使用Java库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用开源java库来可视化图形中的节点和边缘,但我完全迷失了。



我有一堆文件夹中的jar文件。点击一些jar文件可以弹出java swing窗口并显示图形。点击其他jar文件什么都不做。



如果我想出来的话,我会将jar文件与其他文件一起粘贴在那里,还是仍然不起作用? / p>

如果我弄清楚如何使用这些文件,这是否意味着如果我将我的java项目转移到另一台计算机,我必须包含它们?我该怎么做呢?

解决方案

您是否已将这些库包含在类路径中?



如果你正在使用eclipse,你可以



项目 - >属性 - > Java构建路径 - > addJar。



Jar文件应放在工作区内的目录中(例如lib /)



如果必须将项目带到另一台计算机,您可以采取以下步骤


  1. 在执行任何操作之前,请导出项目(例如,作为Jar文件)。

  2. 将其保存到您最喜爱的驱动器(cd / usb驱动器/软盘/磁带)中。

  3. 在另一台计算机上,您可以将此项目导入工作区


I'm trying to use an open source java library to visualize nodes and edges in a graph, but I'm completely lost.

I have a bunch of jar files in a folder. Clicking on some of the jar files makes java swing windows pop open with graphs displayed. Clicking other jar files does nothing.

If I figured that out, would I just stick the jar files in there with the other ones, or would that still not work?

And if I ever figure out how to use these files, does that mean that I have to include them if I transfer my java project to another computer? How would I go about doing that?

解决方案

Have you included those libraries in your classpath?

If you are using eclipse, you could

Project - > properties -> Java build path ->addJar.

And the Jar file should be placed in a directory inside your workspace (lib/ for example)

If you have to take your project to another computer, you could take these steps

  1. Before doing anything, export your project (as a Jar file, for example).
  2. Save it into your favorite drive (cd / usb drive/ diskette/ tape).
  3. On "the other" computer, you can import this project into your workspace

这篇关于你如何使用Java库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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