-
Package problem
I have a sample application all from a java book. All the .java files start
with "package sample;" and all are in a directory named sample.
I am working on a pc and when I try to execute I get an exception
Wrong name search/SearchApp
where SearchApp is the classname. But the slash seems to be the foward slash
a la UNIX not the backslash of DOS. How do I get this to work?
I got it to work by commenting out the package statements but I want to know
what is the correct way to use packages.
thanks
-
Re: Package problem
To compile one of those files, you need to type
javac sample/WhateverClass.java
and to run it you need to type
java sample/WhateverClass
If the book didn't explain this, then I would suggest you get a different
book.
PC2
"Rob" <Robert.S.cascella@lmco.com> wrote in message
news:3c55b589$1@10.1.10.29...
>
> I have a sample application all from a java book. All the .java files
start
> with "package sample;" and all are in a directory named sample.
> I am working on a pc and when I try to execute I get an exception
>
>
> Wrong name search/SearchApp
>
> where SearchApp is the classname. But the slash seems to be the foward
slash
> a la UNIX not the backslash of DOS. How do I get this to work?
>
> I got it to work by commenting out the package statements but I want to
know
> what is the correct way to use packages.
>
> thanks
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks