Java EE application fails to compile due to package that do not exist when using IntelliJ IDEA
<p>I am beginner in Java and I have a problem when using:</p>

<pre><code>import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
</code></pre>

<p>Compiler writes this error:</p>

<pre><code>Error:(3, 32) java: package javax.enterprise.context does not exist
Error:(4, 20) java: package javax.inject does not exist
Error:(6, 2) java: cannot find symbol symbol: class Named
Error:(7, 2) java: cannot find symbol symbol: class RequestScoped
</code></pre>

<p>I think it will be problem with path to the packages or something like it. I am using IntelliJ IDEA 14, GlassFish 4.1.1. On NetBeans it works fine but I want to try IntelliJ IDEA.</p>

<p>My code:</p>

<pre><code>package beans;

import java.util.Random;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

@Named
@RequestScoped
public class RandNumberBean {

    private Random randGenerator;

    public RandNumberBean() {
        randGenerator = new Random();
    }

    public int getRandNumber() {
        return randGenerator.nextInt(100);
    }
}
</code></pre>