/help

"Caused by: java.lang.ClassNotFoundException: Date" I went to the project properties-?Java build path -> Libraries -> Add external class folder Then I went to "Order and export" and I activated everything and it is still doesn't work.. why?
No description
No description
46 Replies
JavaBot
JavaBot11mo ago
This post has been reserved for your question.
Hey @Yarden! 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 closed 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.
dan1st
dan1st11mo ago
Do you have other classes in the same package?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
dan1st
dan1st11mo ago
Eclipse
Yarden
YardenOP11mo ago
Nope only this right now Didn't do much Just created the class, added the external class "Date" and activated javaSE-1.8
dan1st
dan1st11mo ago
Can you show the project in the package explorer? How did you add it? and can you show that external class? And why did you add it? Did you add it to the build path somehow?
Yarden
YardenOP11mo ago
No description
Yarden
YardenOP11mo ago
I added an external class that I got from the university as homework. I need to create a main class which uses it's functions\methods
dan1st
dan1st11mo ago
ok so the difficulty is that you can't really access anything in the default package What is shown when double-clicking the Date.class?
Yarden
YardenOP11mo ago
No description
Yarden
YardenOP11mo ago
there is more
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Yarden
YardenOP11mo ago
Never did it How do I do this? import java.util.Date?
dan1st
dan1st11mo ago
Do you have access to the source code of that clas?
Yarden
YardenOP11mo ago
Nope Only the class We will implement the class code in the next homework
dan1st
dan1st11mo ago
then you can't really change the package of that class Did your teachers tell you how to do that thing with referenced libraries?
Yarden
YardenOP11mo ago
They recommended to work with blueJ, but I hate this workspace Prefer eclipse With blueJ everything is simpler with classes But I just prefer to know how to do so also with eclipse
dan1st
dan1st11mo ago
ok I don't know whether that's possible, it's definitely not something that should be done and I guess BlueJ does something a bit weird You could try copying the class file to the bin directory open the project in your file explorer (outside of Eclipse) Is there a bin directory?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Yarden
YardenOP11mo ago
Tried to copy to bin Didn't work @borgrel @dan1st | Daniel I think i'll just work with blueJ
dan1st
dan1st11mo ago
Can you show that? you should be able to switch back as soon as you don't have any such class files in the default package or maybe you could try to copy the class file to the src directory
Yarden
YardenOP11mo ago
I restarted eclipse and I got a big error about this class inside the bin, and now it shows errors in the main
No description
No description
dan1st
dan1st11mo ago
Can you show the errors?
Yarden
YardenOP11mo ago
No description
Yarden
YardenOP11mo ago
Like it doesn't even exist
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
dan1st
dan1st11mo ago
Do you still have the external class file folder thing?
Yarden
YardenOP11mo ago
Do you mean this?
No description
Yarden
YardenOP11mo ago
I'll ask to replace him hahaha
dan1st
dan1st11mo ago
the libraries tab
Yarden
YardenOP11mo ago
No description
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Yarden
YardenOP11mo ago
Yeah they are asking us to use an old version of java so we can practice the "harder way"
dan1st
dan1st11mo ago
it is if you use BlueJ
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
dan1st
dan1st11mo ago
I am not so sure about that most IDEs allow using the default package at least Eclipse, IntelliJ and VSC do Can you expand the date class thing there? And also copy the Date.class file to both the src and bin folder?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
dan1st
dan1st11mo ago
yeah I might have time to check this more later
Yarden
YardenOP11mo ago
Thank you anyway for helping, I appreciating this! I moved to blueJ for now
JavaBot
JavaBot11mo 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. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
dan1st
dan1st11mo ago
@Yarden ok so I tested it and for me, it works in Eclipse So you need to create one folder containing the Date.class somewhere you don't need to put it in src or bin
dan1st
dan1st11mo ago
in the Libraries tab of the build path, select Add external Class Folder and select the folder with the Date.class file
No description
dan1st
dan1st11mo ago
and then I was able to use it
dan1st
dan1st11mo ago
No description
dan1st
dan1st11mo ago
even if both are in the default package maybe make sure you are using the latest Eclipse version or try with a newer Java version (but make sure you are using the classpath and not the modulepath for the external class folder)
JavaBot
JavaBot11mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server