2

I'm on Arch linux x64 machine , I installed intellij idea but whenever I open a project a startupabortedexception occurs with the JavaDoc browser plugin.

I looked into my idea.log and figured out that it can't find javax.servlet.Servlet, I disabled the plugin in order to open a java project and indeed when I type import javax; it says it can't find javax.

I have java-openjfx installed and still intellij can't find it, what to do in this case ? .

Environment information

jdk:openjdk 1.8.0_60 64 bit.
intellij version: 14.1.5 community edition.

Goal

My goal is to get the JavaDoc browser plugin to work not to program in javax.servlet, I don't intend to do any web development with java right now.

niceman
  • 2,653
  • 29
  • 57

2 Answers2

1

If you don't have Maven project, you can just add the jar to the project. The one you are missing can be downloaded from:

http://mvnrepository.com/artifact/javax.servlet/javax.servlet-api/3.1.0 (just click "Download (JAR)" button)

Greg Witczak
  • 1,634
  • 4
  • 27
  • 56
  • I copied the jar file to my classpath( /usr/lib/jvm/java-8-openjdk/jre/lib in my system) , I can now see javax but not javax.servlet, intellij says it can't find the servlet package though the jar file contains it – niceman Oct 03 '15 at 20:06
  • @niceman I think that adding `jar` to internal JDK directory might not be a good idea. Check how to add jar to single project only: http://stackoverflow.com/questions/1051640/correct-way-to-add-external-jars-lib-jar-to-an-intellij-idea-project If it's not working, maybe try to add whole JEE lib? http://mvnrepository.com/artifact/javax/javaee-api/7.0 – Greg Witczak Oct 04 '15 at 10:08
  • I guess I didn't make my question clear , I'll edit it – niceman Oct 04 '15 at 12:38
0

The class javax.servlet.Servlet is not part of the standard JDK, it is part of the JEE, so you have to add servlet-api.jar to your classpath.

If your project is a Maven project you add the dependency like this:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
</dependency>

And you probably want to add

<scope>provided</scope>

as this dependency is most likely present in your application server.

hotzst
  • 7,238
  • 9
  • 41
  • 64
  • I don't have a maven project, what I have is an IDE plugin that doesn't work and needs javax, besides not only javax.servlet not found but the whole javax not found and I know that javax contains swing which is definitely part of the standard JDK – niceman Oct 03 '15 at 10:32
  • hmmm but servlet is indeed part of JEE, but how come intellij community use it, from my understanding JEE isn't free(is it?) – niceman Oct 03 '15 at 17:21
  • @niceman JEE is free. As we can read on Oracle's website "Java EE technology is a set of standards that many vendors can implement.". And Oracle is providing example implementation in Glassfish Server, which is Open Source (GNU GPL). – Greg Witczak Oct 03 '15 at 18:14
  • @gogowitczak sorry my mistake , I guess I got used to "Enterprise edition!=free" :) – niceman Oct 03 '15 at 19:44