This is my MRE.
Here is how my project is structured
Settings.json file
{
"java.project.referencedLibraries": [
"lib/weka.jar"
]
}
Main.java
import weka.core.Instances;
public class Main {
public static void main(String[] args) throws Exception {
// Load a dataset (replace with your .arff file)
System.out.println("Hello");
}
}
main.class
// Source code is decompiled from a .class file using FernFlower decompiler (from Intellij IDEA).
public class Main {
public Main() {
}
public static void main(String[] var0) throws Exception {
System.out.println("Hello");
}
}
The error coming from main.java is
Unused Import(hints(1): 1:1-1:28)
package weka.core does not exist(errors(1): 1:8-1:12)
The import weka.core.Instances is never usedJava(268435844)
package weka
weka
upon running
javac -cp .;lib/weka.jar src/Main.java
compiles with no issues. this cmd built a Main.class in my src folder.
however, upon running
java -cp .;lib/weka.jar Main
the error is
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
javac -cp .:weka.jar Mcve.javawithimport weka;inMcve.javaproduces a class file, no errors. Maybe edit and simplify the question. If you can compile on the command line, it's a vscode problem. If you can't maybe the download was bad.unzip -l weka.jarshould show what's in the jar file. Add a minimal reproducible example, i.e., start with just importing weka and compiling just 1.javafile. As is, this may not be reproducible.Main), and your only issue is messing up some paths... How come you mix up VSCode and command line. Can you isolate things and only build and run anything via a command line, not VSCode? And then address VSCode build and run...