2

I've just installed Eclipse Indigo for EE and Java EE 6 SDK/JRE from Sun. I need all those to compile a 3rd party Java project using the "javax.*" classes. What I cannot understand how to reach those classes?

How can I import or otherwise connect to "javax.*" classes inside Eclipse?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
OGP
  • 950
  • 2
  • 11
  • 26
  • Some `javax.*` packages come with the JDK, some don't. Which exactly packages/classes do you need? – Eli Acherkan Jul 27 '11 at 05:52
  • See also http://stackoverflow.com/questions/4076601/how-do-i-import-the-javax-servlet-api-in-my-eclipse-project – VonC Jul 27 '11 at 07:23
  • Actually I was looking for javax.inject.* and javax.enterprise.*. – OGP Jul 27 '11 at 08:44
  • I've found the "javaee-api-6.0.jar". But I understand it should be a part of Java EE? Am I correct or wrong? – OGP Jul 27 '11 at 08:46

2 Answers2

1

They're in the Java EE implementation. In other words, they're in the application server. For example, Glassfish, JBoss AS, Tomcat, etc.

In Eclipse, just integrate the target server in Servers view and associate the dynamic web project with it. You can select it during dynamic web project creation wizard:

enter image description here

or afterwards via Targeted Runtimes in project's properties:

enter image description here

Once associated the project with the application server, Eclipse will do all the necessary magic to make those classes available during compiletime. To verify it, the associated server should be listed as Library in project's Build Path property:

enter image description here

Note once again, you don't need to change/fiddle anything in there! If you did some attempts beforehand while shooting in the dark in order to "fix" this problem, then you should make sure that you've undone it all, or things may still go wrong.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
0

Make sure you have all the settings in preferences set. Go to 'Window' -> 'Preferences' and then check the 'Installed JREs', point it to your newest and greatest jre within downloaded jdk. If that doesn't work, download jdk and eclipse Java EE again and start from scratch. Also make sure you have a java and javac added to your PATH (either on Linux or Windows)

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Kris
  • 5,714
  • 2
  • 27
  • 47
  • "Installed JREs" is correct and points to the last JDK installed. Still I need to manually add "javaee-api-6.0.jar" to allow class import. Anyway the problem is resolved. – OGP Jul 27 '11 at 13:03
  • This answer is utterly unhelpful. OP asked for the Java EE libraries, not the Java SE libraries. – BalusC Mar 21 '13 at 02:24