How to set java EE version for liferay ide - java

I was using java 6 SE, but now, when i used wsdl2java, it generated class using javax.xml.ws.Service in EE version, so i have downloaded and installed java 6 EE, but i'm not sure where should i change java version from SE to EE in my portlet project.
I have installed few tomcats and glassfishes servers, including one downloaded from oracle website as "java ee sdk" package (http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u3-downloads-439814.html). Still i have no idea where I can locate jre that uses EE api instead of SE api. I googled that there should be directory glassfish3/jdk, but there is nothing like this.
Only JREs i can find are java 6 and 7 SE.

Finally found out how to do that. First, you need to download java EE API (empty signatures, without method code bodies) packed as jar. It can be downloaded from maven central repo.
http://search.maven.org/ + javaee.api gives result of http://search.maven.org/remotecontent?filepath=javax/javaee-api/6.0/javaee-api-6.0.jar (i'm using jre 6).
Now i put that jar into my portlet project. In eclipse its:
project settings -> Java Build Path -> Libraries -> Add External JARs...
Then after java ee api jar is inside of project, you must move it above SE JRE:
project settings -> Java Build Path -> Order and Export
And thats it. You can work with EE API without any errors. Keep on mind that this jar provides ONLY empty API. Such application must be deployed to java EE driven server, most likely you want to deploy it to glassfish (tomcat by default uses SE, not EE, however you can set up tomcat to use EE).
If you need tomcat + EE as me (for sake of liferay IDE that doesn't work well with glassfish), check out that project http://tomee.apache.org/downloads.html
Note: I didnt used it yet so i cannot confirm if it works fine with liferay and liferay IDE.

Related

How to integrate standalone Java EE 6 inside Eclipse IDE

I am facing issue with Maven 3.x where I am getting Guice Provision error.
With further debugging and investigation, I found the core issue that it is due to Java EE 6 not present inside my Eclipse IDE (Java EE 5 is there with one web server installed) and Guice library is looking for some Java Class which is available with Java EE 6.
Is it possible that I integrate the standalone JavaEE 6 inside Eclipse IDE without installing any webserver or updating the current one?
You can add a maven dependency for Java EE 6 (http://search.maven.org/#artifactdetails%7Cjavax%7Cjavaee-api%7C6.0%7Cjar) to your project, and eclipse will gladly understand it.
However, your runtime will also need to be a Java EE 6 compliant container. Otherwise, you'd simply be looking for trouble. You may run into problems at runtime if you use a pre-Java EE 6 container (especially if you use newer features -- such as CDI).
Alternatively, if your library wants a specific feature (like, as I dare to guess, the CDI api), then you can add just the CDI jars to your classpath (check http://search.maven.org/#artifactdetails%7Cjavax.inject%7Cjavax.inject%7C1%7Cjar)

Setting up Java and Eclipse IDE - Redundant installations

Am I doing the same thing by installing the Java EE package from the official Java website and installing the Eclipse IDE for Java EE developers? Do they have the same components?
No they do not have same components!
Difference between Eclipse for Java EE and Classic version of Eclipse with Java EE libraries is that you have editors for various things like HTML to JSP/JSF. You also have additional functionality like servers to configure. But irrespective of Eclipse you are using you need the java EE library to run your apps. So you either install Java EE SDK(and then configure Eclipse to use this SDK) or use a dependency manager.
When you download Eclipse IDE for Java EE you get tools for developing EE applications. For eg. XML editors and tools, servers etc. Before you start running your EE applications you have to specify installation path for your server like Tomcat or Glassfish which is also a part oh your Java EE SDK installation. These servers containers provide the runtime libraries needed for your dynamic web projects to run. Yes you still need the libraries at compile time which is why most programmers use some dependency manager like Apache Ivy or Maven. Also Java EE libraries like javax.annotation you have to provide it in dependency manager.
So if I just installed Java SE first and then Eclipse for Java EE, wouldn't I have the Java EE libraries?
No! So when you install Java SE you will get standard java libraries.When you install Eclipse(and configure it to use Java SE SDK you just installed) for Java EE(including server) you will have all the tools required to configure and run web application. But if you want EE functionality you need to add those corresponding libraries - either install SDK or use dependency manager. So both - Eclipse for Java EE and Java EE SDK are really two different things and you need both to run Java EE applications.

Eclipse and JAVA EE 7

I have downloaded Java EE 7. My question is what plugins should I download to make ECLIPSE working as good as it is possible with JAVA EE 7?
I mean I am new to servlets and JSP I have to be able to create Project that has all required files folders etc (Like when I create ordinary Java project in Eclipse).
I know my question is not to specific but in general:
I want to have all my files in one project (Like in ordinary Java project in ECLIPSE)
I want deploy it in easy way
What plugins I have to install on Eclipse to achieve this?
I am using TOMCAT server but when I installed JAVA EE 7 it installed GLASSFISH which one use?
The easiest way to build Java EE projects is to download new Eclipse IDE for Java EE Developers which is available here
Eclipse for Java EE Developers is everything what you need for your beginner projects. There is no point to look for anything else for your purposes in my opinion.
You can use tomcat or glassfish for your projects. You can configure it by yourself in Eclipse.
To do this go to menu bar.
Window/Show view/Other/type "server" than press OK
New window will show up with link "No servers are available. Click this link to create a new server"
New windows will appear where you can add server of your choice. Personally I prefer Tomcat.
If you have problems with it find beginners movies on youtube where you can easily find how someone else creates java ee projects in eclipse.
Hope that make sense for you.
Most of the plugins work in Java EE 7. To deploy it you can use an Ant File and can use any server (Tomcat, Glassfish, Jboss...).
Maybe, Git plugin will be useful to save your code in the cloud.
Not need to any plugin if you download java EE 7 jsp and servlet are standard for javaEE and when you create new jEE project it will contain all your folder as java standard with additional folder as web.xml and web-inf which contain your jsp pages ,you can user Maven to manage your project and i advice tomcat as server with jEE

Want to create Java EE project in Java SE eclipse

I have Eclipse Indigo for Java SE and I have Tomcat in Ubuntu. I would like to develop a Java EE application, using Servlet and JSP.
My Eclipse doesn't include Java EE support. Can I add this somehow? If yes, any extra tool or plugin I need to install or download?
Yes. You'll need to use a server like Tomcat to run your application anyway. (Which you have already.) It comes with <tomcat install>/lib/servlet-api.jar. Just include this in your classpath when developing so the code compiles.
Since Tomcat doesn't support the full Java EE spec, it only gives you the Servlet APIs. But that is enough for what you are doing.

How to add Java EE SDK libraries in IntelliJ IDEA 11

I have installed the Java EE SDK on my Windows machine and I got a glassfish3 folder. Which files, and how do I add the libraries needed in IntelliJ? And is the servlet api included in the sdk?
It depends on what you are going to develop. Normally IDEA needs just Java SE SDK and when you need Java EE features, you specify an application server in Settings | Application Servers.
Application server libraries include servlet and many other Java EE APIs. In IntelliJ IDEA module settings application server is added as a dependency so that all the APIs will be available for code completion, running and debugging.
Check out Tomcat and other tutorials if you are just starting.
You can create a project and once a basic setup with Java EE support is created, hit F4 on the module. This will open up the module settings (you can also right click on a module and open the Module Settings item).
This is your one stop entry for all things settings. You can add a library, module library, global SDK etc from here.
Generally, when you create a library, you can specify all the directories under which you have your jars.
For example: In your case, you might need to add servlet.jar in the project path. Just add a library with the Jar directory path in which the servlet jar exists.

Categories