Help importing from NetBeans? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Help importing from NetBeans?

I created this code in NetBeans for my Computer Science class, and on NetBeans, it runs. However, when I try to run the code on the code playground here, it can't find the main class. Any idea what could be wrong? https://code.sololearn.com/cp1znKt95xFK

11th Jan 2018, 4:23 AM
Jacob Garcia
Jacob Garcia - avatar
4 Answers
+ 2
When you get the dialog, you must enter all responses required by the program. Your code is run on a remote server with no interaction with you. That one prompt is your only method of providing input. The program gets around 4 or 5 seconds of CPU maximum. If it isn't finished, it is timed out. All output is sent back to your device and displayed.
11th Jan 2018, 5:12 AM
John Wells
John Wells - avatar
+ 2
Ah, I get it. Thank you :)
11th Jan 2018, 5:28 AM
Jacob Garcia
Jacob Garcia - avatar
+ 1
Delete or comment out your package statement.
11th Jan 2018, 4:35 AM
John Wells
John Wells - avatar
+ 1
Well without the package, it starts to run, but after the first input this is what I get... Guess a number between 1 and 1000: Guess too high, try again. Guess a number between 1 and 1000: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at GuessingGame.main(GuessingGame.java:20)
11th Jan 2018, 4:42 AM
Jacob Garcia
Jacob Garcia - avatar