aspose file tools*
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
Author

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 3.3.1.1

Please help.

thanks

gurpreet
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38334
    
  23
  • 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
    Hello,

    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.

    gurpreet
    Paul Clapham
    Bartender

    Joined: Oct 14, 2005
    Posts: 18541
        
        8

    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.

    classpath
    c:\java\bam.jar
    I am doing in enviornment variables

    please help

    gurpreet
    Paul Clapham
    Bartender

    Joined: Oct 14, 2005
    Posts: 18541
        
        8

    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: 16012
        
      19

    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.


    Customer surveys are for companies who didn't pay proper attention to begin with.
    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.ws.java2wsdl.SchemaGenerator.<init>(SchemaGenerator.java:121)
    at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:306)
    at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:339)
    at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:98)
    at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:175)
    at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:79)
    at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:582)
    at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:201)
    at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:271)
    at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:189)
    at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:110)
    at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:257)
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:74)
    at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:486)
    at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:406)
    at org.apache.axis2.transport.http.AxisAdminServlet.init(AxisAdminServlet.java:51)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:448)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
    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(Bootstrap.java:295)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

    Please tell me solution of the problem

    thanks

    gurpreet
    Ilja Preuss
    author
    Sheriff

    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: http://aspose.com/file-tools
     
    subject: How to make reference to other packages in Eclipse?