facebook

Importing classes from default package [Closed]

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #237507 Reply

    markcoth
    Member

    Environment:

    MyEclipse Version: 20050829-4.0.0-GA
    Eclipse Version: 3.1.0 I20050513-1415
    Java SDK: 1.4.2_07-b05

    I am trying to import a class from a library that I put in the project’s build-path. The class resides in the default package:

    import ClassName;

    I am getting a “The import ClassName cannot be resolved….”

    I created a simple Java project, created a test class (TestDefault) in the default package, create another class in the package com (ComClass) and tried to import the class from the default package into the class in the com package. The same problem occurs.

    
    
    public class TestDefault {
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub
    
        }
    
    }
    
    
    package com;
    
    import TestDefault;
    
    public class ComClass {
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub
    
        }
    
    }
    

    I refactor and move the class from the default package to the package “com.another” and everything works.

    
    package com.another;
    
    public class TestDefault {
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub
    
        }
    
    }
    
    
    package com;
    
    import com.another.TestDefault;
    
    public class ComClass {
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub
    
        }
    
    }
    

    I have used Eclipse for a while and do not remember having this problem.

    Am I missing something simple?

    #237517 Reply

    markcoth
    Member

    Found my own answer. The code I was compiling is meant for Java 1.3 and I was compiling under 1.4.

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4361575

    #237528 Reply

    Scott Anderson
    Participant

    Eclipse Version: 3.1.0 I20050513-1415

    Mark,
    Glad you found an answer. However, you really need to install Eclipse 3.1 final in a new location and then MyEclipse 4.0 on top of that. The milestone build you have *will* cause problems with some features since the APIs changed for 3.1 final.

    #237532 Reply

    Riyad Kalla
    Member

    Mark,
    A quick observation: If you are using classes in the default package, I’m pretty sure Java ninjas will kill you in your sleep.

    Secondly it seems you are not using a final GA build of Eclipse 3.1, while this may work with MyEclipse mostly, you will start to notice little breaks, exceptions or annoynaces. If you do, before you post here be sure to reinstall a fresh copy of Eclipse 3.1 GA, then using Help > Software Uppdate > Manage Config, RIGHT CLICK > Add New Extension (point to your MyEclipse dir) hit OK.

    and then add -clean to your command line and restart MyEclipse. If you still have problems then, post back (if you decide to these steps).

    #237560 Reply

    markcoth
    Member

    Thanks for the info.

    The ninjas will attack the third party provider of the library I’m using — NOT ME!!!

    I’ll update Eclipse to avoid other problems. As for the original problem, I really shouldn’t have to import default package classes anyway.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Importing classes from default package [Closed]

You must be logged in to post in the forum log in