Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Dummies : EchoLine(Runtime error)
Dummies : EchoLine [message #1795202] Tue, 18 September 2018 10:45 Go to next message
Henrick Leow is currently offline Henrick LeowFriend
Messages: 5
Registered: September 2018
Junior Member
I follow the dummies book and i written :

import java.util.Scanner;

class EchoLine {

public static void main(String args[]) {
Scanner keyboard = new Scanner(System.in);
System.out.println(keyboard.nextLine());
keyboard.close();
}
}

The error shown :

Must declare a named package because this compilation unit is associated to the named module 'MyNewProject'

The console tab shown :
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: C:\Users\Leow\myfirst-eclipse-workspace\MyNewProject\bin
Caused by: java.lang.module.InvalidModuleDescriptorException: EchoLine.class found in top-level directory (unnamed package not allowed in module)

Anyone can advise what wrong ?

Thanks
Re: Dummies : EchoLine [message #1795206 is a reply to message #1795202] Tue, 18 September 2018 11:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29593
Registered: July 2009
Senior Member
It's probably better to ask on the JDT forum:

https://www.eclipse.org/forums/index.php/f/13/

I'm not familiar with how modules are supposed to work, but it would seem the the easiest quick solution would be to use Refactor -> Move... from the context menu of your EchoLine.java file in the Package Explorer, create a package, and move the class to that package.
Re: Dummies : EchoLine [message #1795254 is a reply to message #1795206] Wed, 19 September 2018 10:37 Go to previous message
Henrick Leow is currently offline Henrick LeowFriend
Messages: 5
Registered: September 2018
Junior Member
Thanks and submitted to JDT forum.
Previous Topic:controlling / overriding mirrors . . .
Next Topic:[ Spring IDE / STS ] Creation of Elements failed
Goto Forum:
  


Current Time: Thu Oct 18 03:47:29 GMT 2018

Powered by FUDForum. Page generated in 0.02940 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top