Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34904
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Error in build |
| Date | 2016-07-15 15:15 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <nmbcp1$v55$1@dont-email.me> (permalink) |
| References | <746d328e-d360-4268-ace5-07a9931955ae@googlegroups.com> |
On 7/15/2016 2:54 PM, Steve Graham wrote:
> While trying to build, I got the following error. I have tried changing a few things. The classes are adapted from Oracle's Java tutorial. I would think that the Bicycle class would be "pulled in" via the common package statement.
> [... see up-thread for code ...]
>
> Error while trying to build Bicycle Demo:
>
> C:\Users\TheUser \Documents\NetBeansProjects\Bicycle Demo\src\bicycle\demo\BicycleDemo.java:19: error: cannot find symbol
> Bicycle bike1 = new Bicycle();
> symbol: class Bicycle
> location: class BicycleDemo
The way the source files are arranged in directories must mimic the
package structure. Because both files are in a package named "Bicycle"
(aside: not a good name for a package), both should be in a directory
named "Bicycle" as well. As it is, they appear to be in a directory
named "demo" (aside: beneath the very strange looking "TheUserBLANK").
When asked to compile ...\demo\BicycleDemo.java, Java has no trouble
finding the file -- you've given the location on the javac command line.
But when it then tries to find the "Bicycle" class, it looks for
"...\demo\Bicycle\Bicycle.class" or "...\demo\Bicycle\Bicycle.java",
and (of course) fails to find either.
You appear to be using NetBeans. When you tell NetBeans to create
a new package named "Bicycle", it will create "...\src\Bicycle", and
that directory is where "Bicycle.java" and "BicycleDemo.java" should
live.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Error in build Steve Graham <solitary.wanderer52@gmail.com> - 2016-07-15 11:54 -0700 Re: Error in build Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-15 15:15 -0400
csiph-web