K
Kord5mo ago
Canute

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?
No description
33 Replies
gdude
gdude5mo ago
you need to set up the application gradle plugin there's no run task
Canute
CanuteOP5mo ago
do i have to have a main class or can i just have a main function?
gdude
gdude5mo ago
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?
Canute
CanuteOP5mo ago
Main.kt
Canute
CanuteOP5mo ago
No description
Canute
CanuteOP5mo ago
and i put this now in my build.gradle.kts
No description
gdude
gdude5mo ago
so then the class is called MainKt the package is not src.main.kotlin are you new to kotlin?
Canute
CanuteOP5mo ago
yesss haahaha
gdude
gdude5mo ago
do you own a website? or, well, a domain
Canute
CanuteOP5mo ago
no neither ; (
gdude
gdude5mo ago
okay, do you have a github account?
Canute
CanuteOP5mo ago
YES! that i do
gdude
gdude5mo ago
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
Canute
CanuteOP5mo ago
ahhh i see, ok ill try that!
Canute
CanuteOP5mo ago
ok so i assume you ment this setup?
No description
Canute
CanuteOP5mo ago
No description
gdude
gdude5mo ago
make it lowercase but that's roughly what I meant yeah
Canute
CanuteOP5mo ago
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
gdude
gdude5mo ago
and that error is?
Canute
CanuteOP5mo ago
it says it's not using JDK
Canute
CanuteOP5mo ago
No description
Canute
CanuteOP5mo ago
wait what?
gdude
gdude5mo ago
you didn't lowercase it in the build.gradle.kts
Canute
CanuteOP5mo ago
oh i forgot to update the build.gradle
gdude
gdude5mo ago
yeah
Canute
CanuteOP5mo ago
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!!
gdude
gdude5mo ago
no worries did you end up moving to a framework btw? can't tell from the package layout haha
Canute
CanuteOP5mo ago
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
gdude
gdude5mo ago
ah yep, that'd do it well, gg, keep it up haha
Canute
CanuteOP5mo ago
one } to much ahahaha super thanks! and thanks for the help!
gdude
gdude5mo ago
o7 try the rainbow brackets plugin for IJ
Canute
CanuteOP5mo ago
great shout, will give it a try!
gdude
gdude5mo ago
o7
Want results from more Discord servers?
Add your server