Class "Koneksi.Koneksi" does not have main method. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Class "Koneksi.Koneksi" does not have main method.

I've added the MySQL JDBC Driver library, but why does it still get an error? Is there something wrong in the code? Previously I used this code to connect to the database and successfully connected to the database But why when I create a new project and follow this code but instead I get an error https://code.sololearn.com/c95Ze5GKmF2A/?ref=app

25th Jun 2023, 5:29 PM
Nasywa
6 Answers
+ 3
Nasywa you can't use these packages here on sololearn but it does work elsewhere. If you read the error messages on the console com.mysql.jdbc does not exist ( on sololearn )
25th Jun 2023, 6:05 PM
BroFar
BroFar - avatar
+ 2
The problem is most likely not in the code you attached, but in the code you haven't shown or haven't written. Did you read the error message? Main method is missing. If the entry point of your program is a different class, maybe Netbeans doesn't know that, and you need to configure it somewhere in project settings. https://linuxhint.com/no_main_class_found_netbeans/
26th Jun 2023, 3:32 AM
Tibor Santa
Tibor Santa - avatar
+ 1
BroFar I'm using NetBeans, I'm just copying my code to sololearn, to have someone else check what's wrong
25th Jun 2023, 10:18 PM
Nasywa
+ 1
Nasywa There are some library that SoloLearn does not support.. Anyways, the code raises an error, because the main method is not executed! Every.single.program in Java needs to execute the main method.. Try adding the main method outside and after the function Connection koneksiDB(): public static Connection koneksiDB() throws SQLException { //Some code here } public static void main(String[] args) { //Some code here } You must remember that every single program IN JAVA needs the main method, and when defining functions, you must define it outside the main method, and it must be inside the class given when creating new file..(the main method should be in it as well)
26th Jun 2023, 3:31 AM
Dragon RB
Dragon RB - avatar
0
You need to create a function that takes two parameters and returns the sum of all numbers between the two parameters inclusive. The given code takes two numbers from input and passes them to a function called rangeSum(). Task Define the rangeSum() function, so that the code works as expected. Sample Input 4 9 Sample Output [1] 39 Explanation For the inputs 4 and 9, the returned value should be 39.
27th Jun 2023, 4:48 PM
Mohd Juber Shaikh
Mohd Juber Shaikh - avatar
0
Do you know this answer
27th Jun 2023, 4:48 PM
Mohd Juber Shaikh
Mohd Juber Shaikh - avatar