Reputation: 22646
IntelliJ IDEA 12.1.4 Community Edition
Fedora release 18 (Spherical Cow)
Hello,
I have created a package name called com.insystems.gumball
I have a class called Gumball with some functions.
package com.insystems.gumball;
public class Gumball {
/* functions here */
}
Now I have created a new command line app project called gumball_test
package com.insystems.gumballtest;
import com.insystems.gumball;
public class Main {
public static void main(String[] args) {
Gumball gb = new Gumball(5);
}
}
The problem is that I get a:
unused port statement
and
cannot resolve symbol gumball
Both these projects are in different directories as I want to keep all my packages in a directory that I can import whenever I need them.
I am new to Java and IntelliJ so I am not sure how can I set the path of my packages that can be used in my other projects?
Many thanks for any suggestions,
Upvotes: 5
Views: 13695
Reputation: 8938
The problem is in your import com.insystems.gumball;
line (this means import gumball
class in com.insystems
package). Since there is none, you get this error.
You need to import certain class
import com.insystems.gumball.Gumball;
or the whole package
import com.insystems.gumball.*;
This might help to clarify things more
Upvotes: 5