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•4mo 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•4mo ago
How do you compile your code? Are you in the correct directory? Is the classpath set up correctly?
gxmezz
gxmezzOP•4mo 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•4mo ago
Pressing F5 should show the executed command in the console. Can you copy this here?
gxmezz
gxmezzOP•4mo 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•4mo ago
can you send a screenshot where this class is which directory
gxmezz
gxmezzOP•4mo ago
ToDoList?
gxmezz
gxmezzOP•4mo ago
@ayylmao123xdd this?
No description
gxmezz
gxmezzOP•4mo ago
This is where the project is located
ayylmao123xdd
ayylmao123xdd•4mo ago
i meant the folder like src target etc
gxmezz
gxmezzOP•4mo ago
src?
ayylmao123xdd
ayylmao123xdd•4mo ago
yes do you have a folder named
gxmezz
gxmezzOP•4mo ago
i dont get you
ayylmao123xdd
ayylmao123xdd•4mo ago
src
gxmezz
gxmezzOP•4mo ago
i dont know tbh lol lemme have a look
ayylmao123xdd
ayylmao123xdd•4mo ago
you should have folders like src main java
gxmezz
gxmezzOP•4mo ago
yeah i got a java folder
ayylmao123xdd
ayylmao123xdd•4mo ago
can you screenshot it and the folders next to it
gxmezz
gxmezzOP•4mo ago
No description
gxmezz
gxmezzOP•4mo ago
this is jre
No description
ayylmao123xdd
ayylmao123xdd•4mo ago
which ide are you using
gxmezz
gxmezzOP•4mo ago
this is the latest jre
No description
gxmezz
gxmezzOP•4mo ago
whats ide? sorry im kinda new into this
ayylmao123xdd
ayylmao123xdd•4mo ago
the program where you open the file eclipse intellij notepad++
gxmezz
gxmezzOP•4mo ago
vs code
ayylmao123xdd
ayylmao123xdd•4mo ago
@dan1st | Daniel you are absolutely needed šŸ™€ class not found exception can you send a screenshot of the project opened in vs code
gxmezz
gxmezzOP•4mo ago
No description
ayylmao123xdd
ayylmao123xdd•4mo ago
and the files they should be on the left of your screen
gxmezz
gxmezzOP•4mo ago
which files?
ayylmao123xdd
ayylmao123xdd•4mo ago
in vs code file structure something like this
gxmezz
gxmezzOP•4mo ago
hmm
ayylmao123xdd
ayylmao123xdd•4mo ago
xyz abc def
gxmezz
gxmezzOP•4mo ago
i see nothing is it at run and debug section?
ayylmao123xdd
ayylmao123xdd•4mo ago
No description
ayylmao123xdd
ayylmao123xdd•4mo ago
click this button
dan1st
dan1st•4mo ago
No it's what shows you the directories and files
gxmezz
gxmezzOP•4mo ago
theres nothing
gxmezz
gxmezzOP•4mo ago
No description
ayylmao123xdd
ayylmao123xdd•4mo ago
oh you dont have a project open
dan1st
dan1st•4mo ago
open the folder first
ayylmao123xdd
ayylmao123xdd•4mo ago
thats why
dan1st
dan1st•4mo ago
actually no "Create Java Project"
gxmezz
gxmezzOP•4mo ago
what project type? it was working before although i didnt have any project opened
dan1st
dan1st•4mo ago
What options are there?
gxmezz
gxmezzOP•4mo ago
No description
No description
dan1st
dan1st•4mo ago
Do you want to use any libraries?
gxmezz
gxmezzOP•4mo ago
well not for now as im currently a beginner so i dont know about them yet
dan1st
dan1st•4mo ago
Then "No build tools" is fine
gxmezz
gxmezzOP•4mo ago
then? i choose the Java folder? @dan1st | Daniel
dan1st
dan1st•4mo ago
What exactly does it show?
gxmezz
gxmezzOP•4mo ago
The folder where i got my projects
ayylmao123xdd
ayylmao123xdd•4mo ago
so open the folder where you want to make the file or create a new folder and select it
gxmezz
gxmezzOP•4mo ago
why a new window is now opened
No description
gxmezz
gxmezzOP•4mo ago
do i close it and keep with the old one or ?
dan1st
dan1st•4mo ago
the new one is where your project is now Check the src folder that's where you put your classes
gxmezz
gxmezzOP•4mo ago
App.java that one?
dan1st
dan1st•4mo ago
yes
gxmezz
gxmezzOP•4mo ago
Can i change its name? Nice it's now working
dan1st
dan1st•4mo ago
if you also change the name of the class inside the file name must match the class name
gxmezz
gxmezzOP•4mo ago
yeah i noticed that btw @dan1st | Daniel can i ask you for tips as a newbie?
gxmezz
gxmezzOP•4mo ago
yeah i alr asked hahaha
ayylmao123xdd
ayylmao123xdd•4mo ago
lol
dan1st
dan1st•4mo ago
oh you mean general tips?
gxmezz
gxmezzOP•4mo ago
yeah
dan1st
dan1st•4mo ago
I guess make sure you understand all code you are writing maybe not at the very beginning but pretty soon
gxmezz
gxmezzOP•4mo 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•4mo ago
ok
gxmezz
gxmezzOP•4mo ago
So much thanks for your help guys
JavaBot
JavaBot•4mo 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•4mo ago
Post Closed
This post has been closed by <@1068550168225529958>.

Did you find this page helpful?