how to set up dependencies?

I'm pretty new at this so sorry if this is a really dumb question. So I have a project (let's call it project1) and i have all of the files in a package called mylist. Now I have a new project (called project2), and I want to access one of the files from project1. I tried typing

import mylist.*;

which didn't work. Then I went to the project structure->modules->dependencies and added a library with the source and naviaged to the src folder of project1 (under which was the folder for the mylsit package). At this point IDEA stopped complaining about the import statement, and I was able to write code using classes and methods from project1 without any complaints from IDEA. I thought everything was good, but when I went to run the program, I get compile errors saying mylist doesn't exist and the classes in the package can't be found. What is the proper way to set up the dependencies and the imports so that I can use a package from one project in another? Thanks.

2 comments
Comment actions Permalink

You should not create separate projects. Instead use one project with several modules with module-on-module dependencies where needed. See around these links:
http://www.jetbrains.com/idea/webhelp/intellij-idea-vs-eclipse-terminology.html
http://www.jetbrains.com/idea/webhelp/dependencies.html

0
Comment actions Permalink

Thanks that works.

0

Please sign in to leave a comment.