Gradlew run for bot
[SOLVED]The bot works when i run it through Intelij but not when i try the terminal, is this familiar and anyone know how to help?
33 Replies
you need to set up the
application
gradle plugin
there's no run
taskdo i have to have a main class or can i just have a main function?
you have a main class, even if you haven't actually defined it yourself
what's the name of the file with your main function?
Main.kt
and i put this now in my build.gradle.kts
so then the class is called MainKt
the package is not
src.main.kotlin
are you new to kotlin?yesss haahaha
do you own a website?
or, well, a domain
no neither ; (
okay, do you have a github account?
YES!
that i do
so, kotlin was originally designed exclusively for the JVM
your code should be organised into packages to avoid conflicts with other classes
usually you'd use your site with the segments reversed, but since you don't have a site, you can use
io.github.yourusernamehere
right-click the kotlin folder and create a package with that name
then move your files into that package
IJ should update the package
declaration at the top of the file for you
alternatively, you don't have to create package folders, you can just add the line manually to the top of each file, package io.github.yourusernamehere
ahhh i see, ok ill try that!
ok so i assume you ment this setup?
make it lowercase but that's roughly what I meant yeah
okey perfect, it looks like it found the 'run' when i run ./gradlew run --info
only issue now is that im getting a JRE error
and that error is?
it says it's not using JDK
wait what?
you didn't lowercase it in the build.gradle.kts
oh i forgot to update the build.gradle
yeah
yes ahahah let me do that and show the real error
aaaannndd never mind! it worked now! really thankful for the help on this one!
cant stress it enough!!
no worries
did you end up moving to a framework btw?
can't tell from the package layout haha
hahaahhaha no, but i did find the issue with the commands, i kept calling the function regardless because when i was refactoring i put the logic outside of an if condition
ah yep, that'd do it
well, gg, keep it up haha
one } to much ahahaha
super thanks! and thanks for the help!
o7
try the rainbow brackets plugin
for IJ
great shout, will give it a try!
o7