Java Newbie - import cs1.Keyboard;

From: Jason Beauford (Jbeauford_at_mill-max.com)
Date: 10/02/03

  • Next message: ScoutMirim: "Re: Re[2]: Protecting code and data in Windows"
    Date: Thu, 2 Oct 2003 11:34:10 -0400
    To: <secprog@securityfocus.com>
    
    

    Not sure if this is the correct forum but here goes...

    I am learning Java and just encountered something strange...

    When I run my .class file from a directory outside the one that contains
    the cs1\Keyboard.class folder (ie. C:\ rather than C:\Java where C:\Java
    contains C:\Java\cs1\Keyboard.class), I get an "Exception in thread
    "main" java.lang.NoClassDefFoundError: cs1/Keyboard" error.

    However if I run this from the directory which contains the folder
    (C:\Java which again contains C:\Java\cs1\Keyboard.class) it runs
    perfectly.

    My understanding of the "import cs1.Keyboard;" statement is that the
    java compiler is importing this class file into the program when it
    compiles so it can use it when needed making it independent of directory
    structure.

    Is this not the case?

    Can anyone provide a better solution for using Keyboard.class properly
    or maybe some other type of Keyboard input..?

    Thanks in advance.

    Kind Regards,

    JMB.


  • Next message: ScoutMirim: "Re: Re[2]: Protecting code and data in Windows"

    Relevant Pages

    • Re: someone please help me with this.....
      ... Wow....saving any VB class file in the 'App_Code' directory doesn't ... You seem to have everything in the wwwroot folder. ... have any DLL named 'LoginUserFetchDB.dll'. ... Delete the /bin folder after confirming it will compile and continue your development work. ...
      (microsoft.public.dotnet.framework.aspnet)
    • Classes outside App_Code folder in website application (VS2008)
      ... need to place the class file in the same folder as the page that uses it, ... For the same reason, converting to a Web ... would like to keep it in a separate file so I can reference it from several ...
      (microsoft.public.dotnet.general)
    • Re: format all .cs files in the project using visual studio 2005
      ... when you create a new class file, ... remember the folder for VS 2005 off hand, but I used to do it with every new ... Gregory A. Beamer ...
      (microsoft.public.dotnet.framework)
    • RE: Confusion about Namespaces and App_Code, etc. in VS2008/ASP.net3.5
      ... In a Web Application project the App_Code folder is just like a normal ... drag the class file to the ... In this way the IDE will compile the class file. ... Microsoft Online Community Support ...
      (microsoft.public.dotnet.framework.aspnet)