The code in my Java project isn't finding the imports from a referenced library [message #1839437] |
Sun, 21 March 2021 10:09  |
Eclipse User |
|
|
|
Hi, I'm writing a project that uses two classes generated by a different program (Weka generates source code for a decision tree produced when providing one of its classifiers (in my case the J48 algorithm) with training data (recording occupancy of a room (T/F) based on 5 other attributes) that I found online).
I am using Eclipse, so I created a new Java Project in the default workspace, added an external archive to its build path (as I describe below), created two empty Java classes, and pasted in the Weka-generated code. These classes import various classes from the weka.jar file (originally in the program files of the Weka software) which I already added to the project's build path, but all the import lines come up with "Import X cannot be resolved" errors (X being the imported class).
I have two versions of the project:
- one where weka.jar is in a "lib" folder (at the same level as the "src" folder containing the two classes) which I right-clicked on in the package navigator of eclipse and selected Build Path->Add to build path
- the other where I right-clicked on the project and selected Build Path->Add External Archives, and navigated to and selected the weka.jar file (in its original location, the program files of the Weka software) as prompted.
I've done this before in the past with success, and I'm not sure why it's not working now? I've checked the classpath variable in Eclipse and added the path to weka.jar because it wasn't there previously as suggested by someone but the imports still aren't working. I've provided some screenshots to try and help illustrate the error and what seems to me to be no issue with the location of the jar file and classpath. Thanks for any help :)
Edit: UPDATE The error is now "The package weka.classifiers.trees.j48 is not accessible" instead of the previous "Import X is not available"
[Updated on: Thu, 25 March 2021 08:47] by Moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04152 seconds