#Java help with imports

1 messages · Page 1 of 1 (latest)

sly temple
#

guys can somebody pls help me? I got slf4j imported in java in my lib folder and it doesnt show any errors, but when i try to build it does show errors that slf4j package does not exist even though it exists and i imported it

latent widgetBOT
#

<@&987246652869971988> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
Guys can somebody pls help me? I got slf4j imported in java in my lib folder and it doesnt show any errors, but when i try to build it does show errors that slf4j package does not exist even though it exists and i imported it

Your issue is likely related to the build setup not recognizing the SLF4J library even though your IDE shows no import errors. This usually happens when the SLF4J jar is added to your project folder manually but not included in your build path or classpath used during compilation.

Key points to check:

  • Make sure your build tool (e.g., javac command, Maven, Gradle) is configured to include the SLF4J jar in the classpath.
  • If building manually, use something like javac -cp "path/to/slf4j-api.jar;." YourClass.java.
  • If using an IDE build, ensure the library is added as a dependency or external library and linked properly.
  • In a multi-module or multi-folder project, check no mismatch exists between source folder settings and library location.
  • Sometimes the editor shows no errors because it reads project settings, but the command-line or build tool ignores them.

Without proper classpath configuration for compilation, the package does not exist error will show even though your imports appear valid inside the IDE.


Useful links:

sly temple
#

Hello, so I was coding a minecraft launcher and I impoprted gson library but it shows i didnt

#

wait i send you a screenshot of it

sly temple
#

on the other files its the same error

sly temple
#

and some other ones i use (i get errors too on them)

#

i also imported them in libraries and modules

latent widgetBOT
#
TJ-Bot
Ping

Pong — ready. How can I help with your code review?

sly temple
#

and still the same

#

i also asked grok and deepseek none of them helped

#

now I can only hope for help from a real person

#

If someone could help me, I'd be grateful

wet summit
#

Yeah the earlier you learn to never use those the better

#

I'm looking at your screenshots now

#

Ahhhhhh I see

#

So you have two things going on

#

intelliJ and it's configuration

#

And Gradle and it's configuration

#

You added slf4j to intelliJ and so it gives you no red lines

#

But Gradle doesn't have a dependency declaration for it

#

So in your build.gradle look for any "implementation" lines

#

Share what you find

sly temple
#

wait

#

yeah so in my build.gradle i just got this:

#

plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.14'
}

group = 'com.originlauncher'
version = '1.0.0'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenCentral()
}

javafx {
version = "17.0.10"
modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.media' ]
}

application {
mainClass = 'com.OriginLauncher.Main'
}

wet summit
#

Ah I see

#

Javafx is strange in all these

#

Add a new "dependencies {}" section

#

From context clues I think you are modifying an existing project

sly temple
wet summit
#

You've never seen brain damage until you've seen someone who uses AI heavily when learning

#

And we see it here a lot

sly temple
#

only you

#

here

wet summit
#

And other people answer

sly temple
#

yes thanks

#

okay, so thanks for your response, if I got now any prblems I try to ask here

#

on this server

wet summit
#

That or - and I know this sounds wrong - struggle and do trial / error

#

Skill acquisition has basically two steps

#

The first is getting info, the second is reinforcement

#

With AI you skip step 2 and so don't actually learn

sly temple
#

wait wait I need to translate this because this it too much for my english 💔

wet summit
#

Conversely, time you spend struggling builds "debug stamina"

#

And other skills you need to be competent

sly temple
#

yeah now i understand

#

so I should stop using ai from what i translated

#

and understoof

#

understood

wet summit
#

Yes

#

Even though it will be harder

#

Because it is how you get good

sly temple
#

and what about youtube?

wet summit
#

It depends

#

So the big problem with YouTube videos is that if you just watch them or follow along and mindlessly copy their code...you still skip step 2

#

There's nothing wrong with videos so long as you are getting reinforcement

#

But it's harder in that medium for whatever reason

sly temple
#

yes

#

okay thanks