DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: Package problem

  1. #1
    Rob Guest

    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


  2. #2
    Paul Clapham Guest

    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
    >




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links