Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsthe declared package "" does not match the expected package - SOLVED
https://www.eclipse.org/forums/index.php/mv/msg/369033/900197/#msg_900197
I've been trying to learn Java with tutorial from youtube, but since i cant post link i can only sane that it is name "Java Video Tutorial" from user "derekbanas", but the problem I have with it is that when he started recording, he already had his eclipse set up and started project with file already in it.
Now everytime I try to do what he does, I get the error the declared package "" does not match the expected package.
This is what I do:
Start Eclipse, new workspace in Eclipse folder,E:\Eclipse\workspace File>New>Java Project enter>use default JRE (currently jre7),name "Test" press Finish
Expand Test>right click on src>New package>name package defaultPackage in source folder Test/src>Finish
Right click defaultPackage>New File>HelloWorld.java
Enter code>Ctrls+s to save BAM, declared package does not match the expected package.
What Am I doing wrong that I am getting the error?
Thanks for your time
SOLVED: Instead of creating new package, I just clicked on SRC and created new file, naming it HelloWorld and it created the default package by itself.]]>M M2012-08-05T09:14:56-00:00Re: =?UTF-8?B?dGhl77u/IGRlY2xhcmVkIHBhY2thZ2UgIiIgZG9lcyBub3QgbWE=?=
https://www.eclipse.org/forums/index.php/mv/msg/369033/900204/#msg_900204
> Hello,
> I've been trying to learn Java with tutorial from youtube, but since i
> cant post link i can only sane that it is name "Java Video Tutorial"
> from user "derekbanas", but the problem I have with it is that when he
> started recording, he already had his eclipse set up and started project
> with file already in it.
>
> Now everytime I try to do what he does, I get the error the declared
> package "" does not match the expected package.
>
> This is what I do:
>
> Start Eclipse, new workspace in Eclipse folder,E:\Eclipse\workspace
> File>New>Java Project enter>use default JRE (currently jre7),name "Test"
> press Finish
>
> Expand Test>right click on src>New package>name package defaultPackage
> in source folder Test/src>Finish
>
> Right click defaultPackage>New File>HelloWorld.java
>
> Enter code>Ctrls+s to save BAM, declared package does not match the
> expected package.
>
> What Am I doing wrong that I am getting the error?
>
> Thanks for your time
The package statement at the top of your HelloWorld.java file has to
match the directory hierarchy from the src location on. You substitue /
for . in the package name to get the hierarchy.
A package com.test.myapp has to be in the directory hierarchy
com/test/myapp/]]>David Wegener2012-08-05T13:58:20-00:00