File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes How to make reference to other packages in Eclipse? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to make reference to other packages in Eclipse?" Watch "How to make reference to other packages in Eclipse?" New topic

How to make reference to other packages in Eclipse?

Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
hello guys,

I am using Eclipse and I have project in it but I want the access to package of other project. How do I do that ?. I am using

Please help.


Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46337
  • Zip the other project into a .jar.
  • R-click your project on the L panel in Eclipse
  • Properties
  • Build Path
  • Add external jars.
  • Navigate to and select the jar.
  • OK OK OK OK etc
  • Use import statements in the usual fashion.
  • You will have to add that jar to your classpath when you have finished using Eclipse.
  • Gurpreet Saini
    Ranch Hand

    Joined: Jun 09, 2002
    Posts: 295

    The size of the project is 91.4 MB. Is it feasible to do that ?. And if yes I want only one package from that project. How do I do that?.

    thanks in advance.

    Paul Clapham

    Joined: Oct 14, 2005
    Posts: 19973

    The easiest way to do what you ask is to simply add the other project to your project's build path.

    Of course when you come to deploy this project outside of eclipse, it may become an issue that you have to also deploy another 90-megabyte jar file to support it. You might want to restructure your projects into smaller units if that happens.
    Gurpreet Saini
    Ranch Hand

    Joined: Jun 09, 2002
    Posts: 295
    Hello there,

    I am setting the classpath but still it gives me error.

    I am doing in enviornment variables

    please help

    Paul Clapham

    Joined: Oct 14, 2005
    Posts: 19973

    You were asking about Eclipse, weren't you? So messing with the classpath or any other environment variables is useless. Right-click on the project and you'll get a menu option that allows you to change Eclipse's build path for the project.
    Tim Holloway
    Saloon Keeper

    Joined: Jun 25, 2001
    Posts: 17410

    Just to clarify - the build path is the classpath that the compiler will use and shouldn't be considered as having anything in common with the classpath that Eclipse is using.

    Other tasks may have their own classpaths, such as the Ant task, which borrows from the build classpath, but also allows its own classpath settings.

    An IDE is no substitute for an Intelligent Developer.
    Gurpreet Saini
    Ranch Hand

    Joined: Jun 09, 2002
    Posts: 295
    hello there,

    Thank you for the response. I have the jar file in build path of my web services project. It compiles ok but when I start tomcat it gives me the following exception rather its error:

    INFO: The Service service, which is not valid, caused java.lang.NoClassDefFoundError: cit/gaming/amtote/datafeed/UnicodeReader
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.apache.axis2.deployment.util.Utils.fillAxisService(
    at org.apache.axis2.deployment.ServiceBuilder.populateService(
    at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(
    at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(
    at org.apache.axis2.deployment.ServiceDeployer.deploy(
    at org.apache.axis2.deployment.DeploymentEngine.doDeploy(
    at org.apache.axis2.deployment.repository.util.WSInfoList.update(
    at org.apache.axis2.deployment.RepositoryListener.update(
    at org.apache.axis2.deployment.RepositoryListener.checkServices(
    at org.apache.axis2.deployment.DeploymentEngine.loadServices(
    at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(
    at org.apache.axis2.transport.http.AxisServlet.initConfigContext(
    at org.apache.axis2.transport.http.AxisServlet.init(
    at org.apache.axis2.transport.http.AxisAdminServlet.init(
    at org.apache.catalina.core.StandardWrapper.loadServlet(
    at org.apache.catalina.core.StandardWrapper.load(
    at org.apache.catalina.core.StandardContext.loadOnStartup(
    at org.apache.catalina.core.StandardContext.start(
    at org.apache.catalina.core.ContainerBase.start(
    at org.apache.catalina.core.StandardHost.start(
    at org.apache.catalina.core.ContainerBase.start(
    at org.apache.catalina.core.StandardEngine.start(
    at org.apache.catalina.core.StandardService.start(
    at org.apache.catalina.core.StandardServer.start(
    at org.apache.catalina.startup.Catalina.start(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(
    at org.apache.catalina.startup.Bootstrap.main(

    Please tell me solution of the problem


    Ilja Preuss

    Joined: Jul 11, 2001
    Posts: 14112
    That's a new problem, isn't it? Perhaps it would be a good idea to start a new thread about it. When you do, don't forget to tell us how you are starting tomcat and how you deploy your webapp (if you do).

    The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
    I agree. Here's the link:
    subject: How to make reference to other packages in Eclipse?
    It's not a secret anymore!