Class couldn't have been found

I'm trying to compile a plugin but somehow it says the following: Error: The main class ToDoList was not found or loaded Caused by: java.lang.ClassNotFoundException: ToDoList I could compile plugins before but now i cannot do it anymore with any plugin. I've been researching and trying possible ways to fix it but i can't manage to do it. This is the part of the code:
public class ToDoList {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
public class ToDoList {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Thanks in advance.
71 Replies
JavaBot
JavaBot•5d ago
āŒ› This post has been reserved for your question.
Hey @InFiNiTy! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Madjosz
Madjosz•5d ago
How do you compile your code? Are you in the correct directory? Is the classpath set up correctly?
InFiNiTy
InFiNiTyOP•5d ago
To compile it i press the f5 key How can i check the classpath? If it's the bin folder, yeah i think so
Madjosz
Madjosz•5d ago
Pressing F5 should show the executed command in the console. Can you copy this here?
InFiNiTy
InFiNiTyOP•5d ago
& 'C:\Program Files\Eclipse Adoptium\jdk-17.0.15.6-hotspot\bin\java.exe' '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:51486' '-XX:+ShowCodeDetailsInExceptionMessages' '-cp' 'C:\Users\AppData\Roaming\Code\User\workspaceStorage\d646ddf4c7bc51033a126ed95050159c\redhat.java\jdt_ws\jdt.ls-java-project\bin' 'ToDoList' Error: The main class ToDoList was not found or loaded Caused by: java.lang.ClassNotFoundException: ToDoList @Madjosz
ayylmao123xdd
ayylmao123xdd•5d ago
can you send a screenshot where this class is which directory
InFiNiTy
InFiNiTyOP•5d ago
ToDoList?
InFiNiTy
InFiNiTyOP•5d ago
@ayylmao123xdd this?
No description
InFiNiTy
InFiNiTyOP•5d ago
This is where the project is located
ayylmao123xdd
ayylmao123xdd•5d ago
i meant the folder like src target etc
InFiNiTy
InFiNiTyOP•5d ago
src?
ayylmao123xdd
ayylmao123xdd•5d ago
yes do you have a folder named
InFiNiTy
InFiNiTyOP•5d ago
i dont get you
ayylmao123xdd
ayylmao123xdd•5d ago
src
InFiNiTy
InFiNiTyOP•5d ago
i dont know tbh lol lemme have a look
ayylmao123xdd
ayylmao123xdd•5d ago
you should have folders like src main java
InFiNiTy
InFiNiTyOP•5d ago
yeah i got a java folder
ayylmao123xdd
ayylmao123xdd•5d ago
can you screenshot it and the folders next to it
InFiNiTy
InFiNiTyOP•5d ago
No description
InFiNiTy
InFiNiTyOP•5d ago
this is jre
No description
ayylmao123xdd
ayylmao123xdd•5d ago
which ide are you using
InFiNiTy
InFiNiTyOP•5d ago
this is the latest jre
No description
InFiNiTy
InFiNiTyOP•5d ago
whats ide? sorry im kinda new into this
ayylmao123xdd
ayylmao123xdd•5d ago
the program where you open the file eclipse intellij notepad++
InFiNiTy
InFiNiTyOP•5d ago
vs code
ayylmao123xdd
ayylmao123xdd•5d ago
@dan1st | Daniel you are absolutely needed šŸ™€ class not found exception can you send a screenshot of the project opened in vs code
InFiNiTy
InFiNiTyOP•5d ago
No description
ayylmao123xdd
ayylmao123xdd•5d ago
and the files they should be on the left of your screen
InFiNiTy
InFiNiTyOP•5d ago
which files?
ayylmao123xdd
ayylmao123xdd•5d ago
in vs code file structure something like this
InFiNiTy
InFiNiTyOP•5d ago
hmm
ayylmao123xdd
ayylmao123xdd•5d ago
xyz abc def
InFiNiTy
InFiNiTyOP•5d ago
i see nothing is it at run and debug section?
ayylmao123xdd
ayylmao123xdd•5d ago
No description
ayylmao123xdd
ayylmao123xdd•5d ago
click this button
dan1st
dan1st•5d ago
No it's what shows you the directories and files
InFiNiTy
InFiNiTyOP•5d ago
theres nothing
InFiNiTy
InFiNiTyOP•5d ago
No description
ayylmao123xdd
ayylmao123xdd•5d ago
oh you dont have a project open
dan1st
dan1st•5d ago
open the folder first
ayylmao123xdd
ayylmao123xdd•5d ago
thats why
dan1st
dan1st•5d ago
actually no "Create Java Project"
InFiNiTy
InFiNiTyOP•5d ago
what project type? it was working before although i didnt have any project opened
dan1st
dan1st•5d ago
What options are there?
InFiNiTy
InFiNiTyOP•5d ago
No description
No description
dan1st
dan1st•5d ago
Do you want to use any libraries?
InFiNiTy
InFiNiTyOP•5d ago
well not for now as im currently a beginner so i dont know about them yet
dan1st
dan1st•5d ago
Then "No build tools" is fine
InFiNiTy
InFiNiTyOP•5d ago
then? i choose the Java folder? @dan1st | Daniel
dan1st
dan1st•5d ago
What exactly does it show?
InFiNiTy
InFiNiTyOP•5d ago
The folder where i got my projects
ayylmao123xdd
ayylmao123xdd•5d ago
so open the folder where you want to make the file or create a new folder and select it
InFiNiTy
InFiNiTyOP•5d ago
why a new window is now opened
No description
InFiNiTy
InFiNiTyOP•5d ago
do i close it and keep with the old one or ?
dan1st
dan1st•5d ago
the new one is where your project is now Check the src folder that's where you put your classes
InFiNiTy
InFiNiTyOP•5d ago
App.java that one?
dan1st
dan1st•5d ago
yes
InFiNiTy
InFiNiTyOP•5d ago
Can i change its name? Nice it's now working
dan1st
dan1st•5d ago
if you also change the name of the class inside the file name must match the class name
InFiNiTy
InFiNiTyOP•5d ago
yeah i noticed that btw @dan1st | Daniel can i ask you for tips as a newbie?
InFiNiTy
InFiNiTyOP•5d ago
yeah i alr asked hahaha
ayylmao123xdd
ayylmao123xdd•5d ago
lol
dan1st
dan1st•5d ago
oh you mean general tips?
InFiNiTy
InFiNiTyOP•5d ago
yeah
dan1st
dan1st•5d ago
I guess make sure you understand all code you are writing maybe not at the very beginning but pretty soon
InFiNiTy
InFiNiTyOP•5d ago
i currently want to start doing projects so i can learn better and faster i asked AI to give me projects ideas
dan1st
dan1st•5d ago
ok
InFiNiTy
InFiNiTyOP•5d ago
So much thanks for your help guys
JavaBot
JavaBot•5d ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
JavaBot
JavaBot•5d ago
Post Closed
This post has been closed by <@1068550168225529958>.

Did you find this page helpful?