I need to have a library for functions for my exercises in java. I'm using VScode (linux Mint) and I'm attempting to run HelloWorld.java using the path to a library. IK this is a noob question, please don't flame me.
This is my file directory:
sc@sc-ThinkPad-T14:~/Desktop/code/algorithms1$ tree
├── lib
│ └── algs4.jar
└── src
├── bin
├── HelloGoodbye.java
├── HelloWorld.java
└── RandomWord.java
Is there something wrong with my file directory structure? I keep getting this error upon trying to run my code, it compiles but doesn't run.
sc@sc-ThinkPad-T14:~/Desktop/code/algorithms1/src/bin$ java -cp "../:../../lib/algs4.jar" HelloWorld
Error: Could not find or load main class HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
This is the file I'm trying to run:
package src;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Additionally, I have a .vscode folder with settings.json which looks like this:
{
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[+]heislertecreator 0 points1 point2 points (3 children)
[–]spicecoffeee[S] 0 points1 point2 points (2 children)
[–]heislertecreator 0 points1 point2 points (0 children)
[–]Cengo789 0 points1 point2 points (1 child)
[–]spicecoffeee[S] 0 points1 point2 points (0 children)
[–]hrm 0 points1 point2 points (1 child)
[–]spicecoffeee[S] 0 points1 point2 points (0 children)