Results 1 to 2 of 2
  1. #1
    Slimsheivy is offline Member
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Default importing claases from within folder!

    Hi,
    i am having problems importing classes from within the same folder/package.
    i have all my .java files in one folder and on top before the class definition i write "package ClassName;" and in the other that i am importing to i write "import ClassName;" and i see on the tutorial that i am learning from that's its meant to work like this and its not going, i keep getting the error " '.' expected "

    if you can please help me i would really appreciate it it
    Thank You

    Shmuel

  2. #2
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    282
    Rep Power
    6

    Default

    any class being imported must be prefixed by a . and the package name, for e.g. if you have a class called MyClass under mypackage , while importing you need to write

    import mypack.MyClass;

Similar Threads

  1. Importing JXL API
    By ryanlbowen in forum New To Java
    Replies: 0
    Last Post: 07-17-2009, 07:17 PM
  2. importing other classes or using a Jar
    By xhane in forum New To Java
    Replies: 3
    Last Post: 01-31-2009, 05:20 AM
  3. Importing documents
    By stefanybaez in forum Advanced Java
    Replies: 2
    Last Post: 12-22-2008, 07:24 PM
  4. Need help with importing classes
    By Deathmonger in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 10:03 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •