How to add Java EE SDK libraries in IntelliJ IDEA 11 - java

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.

Related

Java Class files in tomcat not linking/updating when using eclipse

I am working on an old jsp project. I have to modify it so that I can use it to meet my needs. I was facing issue while using any newer version of tomcat or java sdk. Therefore, I am using Tomcat 5.5.7 and java SDK 1.5. I have updated java class files of this project using eclipse helios (2012). But the implementation don't show up in my project. Like when I change the database name and run the project it still wants to use the old database name. I have tried to upgrade the whole project to a new version of tomcat and java sdk but it doesn't work. Can anyone help me with this?
Steps you need to take -
Import the project into eclipse - Create a new project, import using existing source files.
You need to setup the Java Facet of "Dynamic Web Application" along with some other Facets to make this application run successfully on the tomcat container inside of eclipse.
You need to install the server tools in eclipse. Using the Java EE perspective is very helpful.
When making changes to the JDK or the server runtime, as you mentioned, you will need to update the projects build path. Right click on the root of your project and go to the build path. Change the SDK version, change the runtime version of tomcat that is included with it. You will need to create a new Java Server runtime for any other versions of Tomcat you want to add to the project.
This is a complicated issue, and there is no specific answer, as your question is very broad. I would recommend watching some tutorials on "How to setup Web application projects in Eclipse." Maybe add Java 5 or 6 to the search to get older results.

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

How to set java EE version for liferay ide

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.

Where to put property file in JBOSS 7 or Glassflish? (Best practice)

I have developed applications for JBOSS EAP 5 with eclipse. I placed property files under server-conf/conf/...
I am now developing in Netbeans (7.2). The bundled glassfish server is used for easier development. The target environment is JBOSS EAP 6. What is the best place to place property files? A common place for both environments would be great.
If you want to have them external to the application you'll probably have to write a custom module. This isn't as bad as it sounds, check out HowToPutAnExternalFileInTheClasspath.
See also migration-issues-to-jboss-7-1
The most practical solution is creating a custom folder outside both JBOSS and Glassfish (i.e C:\PropertiesFolder) then add this folder to the classpath of each server.
Please read my postfor more details about classpath in JBoss

Categories