Java: Importing the RSyntaxTextArea library?

2019-07-21 10:51发布

问题:

I need to import the RSyntaxTextArea to a project of mine, but i can't seem to get it to work!

The homepage is at: http://fifesoft.com/rsyntaxtextarea/ And the download: http://sourceforge.net/projects/rsyntaxtextarea/

But when i download it i get it as a .zip file, not a .jar as a typical library would be.

I'm using netbeans, and i've tried rightclicking on "Libraries" -> add JAR/Folder. But when i try to access something from the project i can't import it.

I need to import the following:

import org.fife.ui.rtextarea.*;
import org.fife.ui.rsyntaxtextarea.*;

It's probably a stupid mistake by me, but i've been struggling with it for a day now and i really want to get it working. Any help is really appreciated!

Thanks!

回答1:

If you extract the zip you will see that the source code lies in src/org/fife/. I don't use Netbeans but you should be able to import that folder after extracting the data.



回答2:

You can also use a maven dependency:

<dependency>
    <groupId>com.fifesoft</groupId>
    <artifactId>rsyntaxtextarea</artifactId>
    <version>LATEST</version>
</dependency>