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