简体   繁体   English

使用Eclipse入门Java

[英]Getting started with Java using Eclipse

I just heard of library for reading/writing excel files without COM, so I figured I'd go check it out. 我只是听说可以在不使用COM的情况下读取/写入excel文件的库,所以我想去检查一下。

I downloaded jexcelapi_2_6_12.zip from this page http://sourceforge.net/projects/jexcelapi/files/ but I have no idea how to open it in Eclipse. 我从此页面http://sourceforge.net/projects/jexcelapi/files/下载了jexcelapi_2_6_12.zip ,但我不知道如何在Eclipse中打开它。

I know it's a silly question, but I'm sure it's not the first time someone's asked it, how do I open this in Eclipse in Windows, compile, run and debug it? 我知道这是一个愚蠢的问题,但是我敢肯定这不是第一次有人问这个问题,我如何在Windows的Eclipse中打开它,进行编译,运行和调试?

Primarily what you need from that zip is the jar which contains the library. 首先,您需要从该zip中获取包含该库的jar。 You'll still need to actually write a Java app that uses it. 您仍然需要编写一个实际使用它的Java应用程序。

So what you need to do is: 因此,您需要做的是:

  1. Unzip the file you downloaded 解压下载的文件
  2. create a new java project 创建一个新的Java项目
  3. add a lib directory to the project 将lib目录添加到项目
  4. copy jxl.jar from the zip into your projects lib directory 将zip中的jxl.jar复制到您的项目lib目录中
  5. right click on the jar in eclipse and select "Build Path>Add to build path" 右键单击eclipse中的jar,然后选择“构建路径>添加到构建路径”

The classes in the library are now available to your project Next create a new java file in your projects source folder and start coding. 库中的类现在可用于您的项目。接下来,在项目的源文件夹中创建一个新的Java文件并开始编码。

Extract the zip file somewhere, put the jar file in your project's directory somewhere (eg under a lib directory) and then right-click on it and select "Add to build path" or something similar. 将zip文件解压缩到某个位置,将jar文件放在项目目录中的某个位置(例如,在lib目录下),然后右键单击它,然后选择“添加到构建路径”或类似名称。

It's not runnable on its own though - you'll need to write some code in order to debug. 不过,它本身无法运行-您需要编写一些代码才能进行调试。

If you want to debug into the source code of the library itself, you'll need to tell Eclipse where the source is - but that's unlikely to be necessary. 如果要调试库本身的源代码,则需要告诉Eclipse源在哪里-但这不是必需的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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