- This topic has 4 replies, 3 voices, and was last updated 19 years, 1 month ago by markcoth.
-
AuthorPosts
-
markcothMemberEnvironment:
MyEclipse Version: 20050829-4.0.0-GA
Eclipse Version: 3.1.0 I20050513-1415
Java SDK: 1.4.2_07-b05I 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?
markcothMemberFound my own answer. The code I was compiling is meant for Java 1.3 and I was compiling under 1.4.
Scott AndersonParticipantEclipse 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.
Riyad KallaMemberMark,
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).
markcothMemberThanks 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.
-
AuthorPosts