0

I am trying to determine whether a set of strings, from an English sentence, are all words from the WordNet dictionary. I put the JARs in a folder in my project in eclipse.

I've downloaded the binary release of extJWNL and put the JARs in a folder called lib.

The project hierarchy in Eclipse IDE with the folder called lib which contains the JARs expanded

I also added these jar files to the class path and the module path using Right Click > Build Path > Configure Build Path:

JAR files under the modulepath and classpath in the properties of the current Java project in Eclipse

I used the following code to try to import dictionary

import net.sf.extjwnl.dictionary;

This error is shown on the import statement

The package net.sf.extjwnl.dictionary is accessible from more than one module: <unnamed>, extjwnl

I thought that this error was showing up because it was a package, not a class/type. But adding a new class and trying to change the package doesn't show this new package, namely WORDNET_JARS, just the default package.

Why is this error being returned and what do I need to do to get rid of the error and import the wordnet packages?

Platforms

I am using Eclipse IDE, and write all this code in Java. The API I am trying to import is the WordNet API.

Edit (8/21/2019)

By removing the module path, it gives a new error:

Only a type can be imported. net.sf.extjwnl.dictionary resolves to a package

Marvin
  • 853
  • 2
  • 14
  • 38
  • Maybe [this](https://stackoverflow.com/a/49063454/11905620) answer to a similar problem might help. – MaS Aug 19 '19 at 08:06
  • This is a similar problem, but then it gives a different error. – Marvin Aug 19 '19 at 08:07
  • You have added the jar in both ModulePath and ClassPath. External jars should be added to ClassPath. Remove from ModulePath. Also you would need a properties.xml to use JWNL. Try following this tutorial https://blog.roland-speith.de/?p=430 – bidisha mukherjee Aug 19 '19 at 08:08
  • 1
    I would suggest to use a dependency management system like maven or gradle. By doing so you avoid to manally build your classpath. The maven coordinates can be found on the project homepage. – DrHopfen Aug 19 '19 at 09:37
  • @bidishamukherjee I am using extJWNL not JWNL, and it has already been downloaded – Marvin Aug 21 '19 at 12:24

1 Answers1

0

I'm surprised it was this easy:

Instead of

import net.sf.extjwnl.dictionary

I had to do

import net.sf.extjwnl.dictionary.*

to get all the types. The only other thing that had to be done had already been done where I add the JARs to the class path

Marvin
  • 853
  • 2
  • 14
  • 38