|
Re: Launch error [message #1818723 is a reply to message #1818721] |
Tue, 24 December 2019 14:48 |
|
You source file should be inside the "src" folder, and preferably in a package other than the default (when no package is declared). Otherwise the compiler doesn't know how to resolve anything your class refers to and anything that tries to refer to your class later on.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Re: Launch error [message #1818735 is a reply to message #1818723] |
Wed, 25 December 2019 12:56 |
Martynas Vertelis Messages: 3 Registered: December 2019 |
Junior Member |
|
|
Thank you for your time answering this. I will give it a go.
And as we are on the topic, if its not too much to ask, could you tell me what/why is happening here:
As all i did here was on myself, rather than book asking me to go and make new project, etc. - so i decided to go step by step and try to do Hello World through eclipse walkthrough, which actually seem to have put me on correct path - before i was just creating a project but not a class afterwards and it would seem this was one of the issues. HelloWorld.java i placed in src folder as you mentioned before but ran out into different situation which i got resolved but do not really understand what was happening there.
I was receiving error "Must declare a named package because this compilation unit is associated to the named module 'HelloWorld'" on the first line, which was resolved by deleting module-info.java (which was added there automatically by Eclipse).
The question i have is why or maybe what is wrong with module-info being in the same folder and what is it supposed to do at all given its added automatically? And if it is relevant for future how can i declare a named package?
[Updated on: Wed, 25 December 2019 12:56] Report message to a moderator
|
|
|
Re: Launch error [message #1818745 is a reply to message #1818735] |
Thu, 26 December 2019 17:14 |
|
module-info.java indicates you want to use the Java Platform Module System, which changes almost everything about how you compose and package your application. If that's wasn't your intention, never have that file.
When you create your project, take special note of the JRE option in the wizard. Anything higher than 1.8 will cause the option to create a module-info.java file to both be possible and selected. I'd suggest you specifically target the 1.8 Execution Environment to avoid this.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Powered by
FUDForum. Page generated in 0.07268 seconds