I am not able to add J2EE 7 libraries to my project in MyEclipse 10 while creating a new project .I want to use websocket api that is available with J2EE 7 in MyEclipse 10 .Is there any way to add those libraries and get content assist features for them
I don't think you can get content assist but you can use User Libraries to create your own library definition containing all the J2EE 7 jar files that you need. Remove the j2EE6 library from your build path and add your J2EE7 user library. You would have to alter the deployment policies for the project, or get it to use the Deployment Assembly to avoid the J2EE7 user library from being deployed (assuming the server you're using has the needed libraries).
If this doesn't help, try asking on the MyEclipse forums.
Related
I've got a project running 1.7. I'm getting issues using javax.enterprise.context.RequestScoped. I'm confused as to why it isn't included as I have other javax.* libraries built into Netbeans by default.
Where can I download this library and how can I add it to my project?
By default, only the packages that are part of the Java Standard Edition are available. This library belongs to Java EE. Just go to project->properties->libraries->add library->Java EE Web 7 Api Library->add. That´s it.
It's part of the Java EE Specification. You should start your project within a container. In Netbeans use an Enterprise Application project type.
Try this:
You can import this jar file into your project.
Use cdi-api.jar
I found mine in glassfish folder
.\glassfish-4.1\glassfish\modules
How can I create and run a JAX-WS web service in a Dynamic Web Project using Eclipse? I'll be using Tomcat 7 as my server. Can you provide a step by step tutorial on how to do it? A hello world web service will do.
I followed this tutorial but I wasn't able to make it run. I did not follow the tutorial's step 4 - 6 because I'm already using Eclipse and the directories are already properly structured on a Dynamic Web Project. Also, my Tomcat is running under JDK 6. Since JAX-WS is already part of JDK 6, there's no need for me to copy it inside Tomcat. When I run the URL indicated in the tutorial, I get a resource not found error.
I think the jax-ws is not part of the JDK. You have to copy the jax-ws implementation into the Tomcat.
Did you find the jax-ws.jar in your JDK folder?
Ok, JDK6+JAXWS often gives problems.
You need to create an endorsed-Folder.
Try to run Tomcat from Eclipse. using these additional VM-Arguments:
-Djava.endorsed.dirs="<your-server>\endorsed" -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.MessageFactoryImpl
-Djavax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.SOAPFactoryImpl
-Djavax.xml.soap.MetaFactory=com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true
now, place the latest saaj-impl and saaj-api to the endorsed folder.
This should work.
I have downloaded the Netbeans version of Java (and not JavaEE). Now I need to create a web application using the IDE. Can you please confirm the website to download the plugin and get the JavaEE features in the IDE.
PS: I am looking for URL where I can download the .nbm file because proxy settings may not allow automatic updates.
Try using the plugin manager
Tools -> Plugins -> Available Plugins
If you're having proxy issues then
Tools -> General -> Proxy Settings
and set your proxy settings.
If you do fin the URL for the nbms you can either use the plugin manager mentioned above, or use the update folder as mentioned in Geertjans' blog.
The website that holds the numerous plugins that implement the Java EE features of NetBeans 7 is here: http://dlc.sun.com.edgesuite.net/netbeans/updates/7.0/uc/final/distribution/modules/enterprise/
You may need to get some other plugins from http://dlc.sun.com.edgesuite.net/netbeans/updates/7.0/uc/final/distribution/modules/websvccommon/, too.
I would encourage you to ask questions about the proxy issues that you are running into with the Update Center. Doing the update manually will be a frustrating experience.
My Netbeans is the version from the Ubuntu 12.04 Software Center repository (7.0). I solved this by checking the options "Certified Plugins","Netbeans Distribution" and "Plugins Portal", which, by default, were unchecked for active. You can find this on
Tools -> Plugins -> Available Plugins
In the "Settings" (last) tab.
By making this, reload the "Avaible Plugins" (that was empty for me) and, after some seconds, lots of categories will appear. Look for Java Web and EE and install them (I found only the Java Web plugin).
I'm new to Eclipse and am using it currently to play with Java EE.
When using Ctrl+Space for types/functions from the regular Java libraries I get a full description (i.e. general description of the type, what are the arguments of the method for, etc.). However I don't get the same for Java EE types.
For example, when using Ctrl+Space on methods of the HttpSession class I get only names like "arg0" or "obj" and no description.
How can I remedy this?
I'd suggest downloading the javadocs and adding them in eclipse. (right click project > properties > java build path > libraries > expand the library > set Javadoc location)
I think that's why Java EE defines a specification only, the implementation must then be done by the provider of your application server. javax.servlet.http.HttpSession e.g. is bundled in servlet.jar.
It you are using Tomcat as your application server, you could attach the java sources to your servlet.jar and then you can browse the source and read it's javadoc.
The source for the latest tomcat is here ->
http://www.apache.org/dist/tomcat/tomcat-6/v6.0.26/src/apache-tomcat-6.0.26-src.zip
I wanted to add what might be very pertinent information for projects using maven and eclipse / wtp. What I did to get the Javadocs to attach nicely was the following 2 steps.
1) I am using glassfish so using the glassfish plugin site I installed the java ee 6 (or 7) documentation. You can easily view this documentation with Help->Java EE 6 docs. I copied the URL from here.
2) Opened my projects build path and went to the libraries tab. Opened the Maven Dependencies and found the java ee 6 api entry (this should be part of the maven project). Opened this up and was able to add a location for the javadocs for the api. I pasted the file:/// url I had copied.
Then I verified this worked by using the ctrl + shift plus mouse pointer hover over some of the java ee 6 classes and methods.
I hope this information will be useful to other who searched and got here but didn't find the solution they were looking for (or for those who now use Maven!).
I have jdk1.6.0_13 installed, but when I try to find a javax.servlet package, or press Ctrl+Space in Eclipse after Servlet I cannot get anything. Where can I download this package, and why isn't it included in standard distribution for developers?
javax.servlet is a package that's part of Java EE (Java Enterprise Edition). You've got the JDK for Java SE (Java Standard Edition).
You could use the Java EE SDK for example.
Alternatively simple servlet containers such as Apache Tomcat also come with this API (look for servlet-api.jar).
A bit more detail to Joachim Sauer's answer:
On Ubuntu at least, the metapackage tomcat6 depends on metapackage tomcat6-common (and others), which depends on metapackage libtomcat6-java, which depends on package libservlet2.5-java (and others). It contains, among others, the files /usr/share/java/servlet-api-2.5.jar and /usr/share/java/jsp-api-2.1.jar, which are the servlet and JSP libraries you need. So if you've installed Tomcat 6 through apt-get or the Ubuntu Software Centre, you already have the libraries; all that's left is to get Tomcat to use them in your project.
Place libraries /usr/share/java/servlet-api-2.5.jar and /usr/share/java/jsp-api-2.1.jar on the class path like this:
For all projects, by configuring Eclipse by selecting Window ->
Preferences -> Java -> Installed JREs, then selecting the JRE you're
using, pressing Edit, then pressing Add External JARs, and then by
selecting the files from the locations given above.
For just one
project, by right-clicking on the project in the Project Explorer
pane, then selecting Properties -> Java Build Path, and then pressing
Add External JARs, and then by selecting the files from the locations
given above.
Further note 1: These are the correct versions of those libraries for use with Tomcat 6; for the other Tomcat versions, see the table on page http://tomcat.apache.org/whichversion.html, though I would suppose each Tomcat version includes the versions of these libraries that are appropriate for it.
Further note 2: Package libservlet2.5-java's description (dpkg-query -s libservlet2.5-java) says: 'Apache Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, and provides a "pure Java" HTTP web server environment for Java code to run. This package contains the Java Servlet and JSP library.'
Have you instaled the J2EE? If you installed just de standard (J2SE) it won´t find.
The normal procedure with Eclipse and Java EE webapplications is to install a servlet container (Tomcat, Jetty, etc) or application server (Glassfish (which is bundled in the "Sun Java EE" download), JBoss AS, WebSphere, Weblogic, etc) and integrate it in Eclipse using a (builtin) plugin in the Servers view.
During the creation wizard of a new Dynamic Web Project, you can then pick the integrated server from the list. If you happen to have an existing Dynamic Web Project without a server or want to change the associated one, then you need to modify it in the Targeted Rutimes section of the project's properties.
Either way, Eclipse will automatically place the necessary server-specific libraries in the project's classpath (buildpath).
You should absolutely in no way extract and copy server-specific libraries into /WEB-INF/lib or even worse the JRE/lib yourself, to "fix" the compilation errors in Eclipse. It would make your webapplication tied to a specific server and thus completely unportable.
If you've got the Java EE JDK with Glassfish, it's in glassfish3/glassfish/modules/javax.servlet-api.jar.
those classes are usually part of servlet.jar
http://www.java2s.com/Code/Jar/wsit/Downloadservletjar.htm