Home > Net >  How can I get stdlib.jar to work in IntelliJ IDEA?
How can I get stdlib.jar to work in IntelliJ IDEA?

Time:04-08

I​ had used the IntelliJ IDEA installer provided in New roject settings

And somehow, got the same error message when compiling: Error message screenshot

I don't know what went wrong :C Any assistance would be highly appreciated.

[Edit - Later on April 7th, 2022]:

Something weird happened. I downloaded the file provided by @CrazyCorder and there was a warning about Amazon Corretto not being installed, that I decided to ignore.

I tried to run the program from the command line, with no luck, because I got the same error message as always. So, I noticed that there was no JDK assigned to the SDK slot in the Project structure, and I chose to use JDK 18 (following the path "File > Project structure > Project"), which is the one that I had previously installed on my computer, but that didn't really change a thing.

Lastly, I tried to run it from the IDE and that's when it finally worked!!! So, thank you, @CrazyCoder :D I still don't know why it doesn't work from the command line, though...

CodePudding user response:

I also vainly tried copying and pasting every .java file from Standard libraries webpage to the same directory where I keep the program files.

This works just fine, you need to place all the .java files from the stdlib.jar into the works fine

The jar with .class files will not work in the dependencies/classpath as you cannot import classes from the default package in Java.

It was an extremely poor choice to keep the classes in the default package and it's the fault of the creators of this library/course. This simple oversight has caused major headaches over the years.

  • Related