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)
    • Re: Fading effect
      ... the images files are in the same folder of the .class file (this has ... For an Applet to read files, ...
      (comp.lang.java.help)
    • Re: Windows form designer generated code being misplaced
      ... Do I just add a new class file to the same folder where the form files ... Make a copy of the .vbproj file in case something goes wrong. ... DependentUpon clause: ...
      (microsoft.public.dotnet.framework.windowsforms)
    • Import Error??
      ... in a class that is in another folder. ... class file contains wrong class: ... the classpath. ... Samuel T ...
      (comp.lang.java.programmer)