Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Simple import problem

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Simple import problem

    I am having trouble importing a class to another one. I am using netbeans, I need to import cisio to Lab10 and for some reason is saying cisio is non existant. cisio compiles and works just fine.
    package cisio;
    import java.io.*;
    public class Main
    {
        static boolean EndOfFile = false;
        public static void main(String[] args)
        {
            EndOfFile = false;
        }
        static int GetChar()
        {
            int c;
            try {
                c = System.in.read();
                if (c == -1) EndOfFile = true;
                return c;
                }
            catch (IOException e)
            {
                EndOfFile = true;
                return -1;
            }
            }
            public static boolean eof()
            {
                return EndOfFile;
            }
     
            public static String GetLine()
            {
                int i;
                i = GetChar();
                String s="";
                while (i>0 && i!= '\n')
                {
                    if(i != '\r') s = s + (char) i;
                    i = GetChar();
            }
                return s;
            }
     
            public static int GetInt()
            {
                return Integer.parseInt(GetLine());
            }
     
            public static double GetDouble()
            {
                return Double.parseDouble(GetLine());
            }
    }

    package lab10;
    import cisio.*;
    /// 2463371
    public class Main 
    {
     
     
        public static void main(String[] args) 
        {
            // TODO code application logic here
        }
     
    }
    Last edited by helloworld922; November 13th, 2009 at 03:05 PM.


  2. #2
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,233
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: Simple import problem

    You most likely have a classpath problem: you have two classes which are in different packages and if they aren't in the correct directories the compiler and JVM won't find them, so you need to tell them where to find them. There is a wealth of tutorials online on how to go about fixing this issue (and can do so better than I), just google "classpath package" or something to that effect.

  3. #3
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: Simple import problem

    i thought netbeans has a classpath exception...?

  4. #4
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: Simple import problem

    and i never encountered any classpath error so far...

Similar Threads

  1. Simple scanner problem
    By Sinensis in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: September 20th, 2009, 09:01 PM
  2. Problem in import com. in eclipse
    By java_cs in forum What's Wrong With My Code?
    Replies: 6
    Last Post: September 11th, 2009, 07:26 AM
  3. Simple Form Help
    By dsen in forum Web Frameworks
    Replies: 1
    Last Post: September 8th, 2009, 11:32 PM
  4. simple problem w/ appelets which i cant figure out
    By JavaGreg in forum Java Applets
    Replies: 7
    Last Post: August 15th, 2009, 07:22 PM
  5. How to import an .tiff image in JSP?
    By jazz2k8 in forum JavaServer Pages: JSP & JSTL
    Replies: 4
    Last Post: May 12th, 2008, 05:55 AM