Java web development without Eclipse - java

I'm interested in doing some Java web development but I'm not really interested in using Eclipse. I have used Eclipse in the past and to me it seems to add a layer of abstraction that I'm not really interested in. However, I'm having a bit of upstart problems.
Does anyone have any good references/tutorials in getting up and running with Java web development without using Eclipse (or any other IDE for that matter)?

Create a maven project and use one of the embedded web servers like jetty or Glassfish.
Also, this approach allows you to work with the command line directly or use either Netbeans, Eclipse or IntelliJ as your IDE as they support Maven projects. I do not think that JDeveloper can yet.
(Eclipse may require the m2e plugin from the marketplace, and it handles all the Eclipse configuration transparently and directly. Highly recommended).

You can easily do java web development using notepad only. The extra work is, you have to write some extra code (like in servlet you have to write web.xml http://www.tutorialspoint.com/servlets/servlets-first-example.htm). Same in Struts, Hibernate and Spring framework, you have to write config file in notepad.

Related

Need help to deploy Java web application

Hi I'm totally new to development. I'm trying deploy a web application on a local server like glassfish/tomcat. Backend of the app is written in Java and ui is created using HTML/css/js . I'm using maven as well. I'm not able to find a way to get this running on intellij CE .
Apparently this functionality is not supported in CE. Can someone suggest a turnaround or a different IDE as good as intellij idea. I've tried eclipse but I didn't find it completely useful
Thanks
There is no IDE as good as IntelliJ. JetBrains makes the best IDEs on the market.
No, I don't work for them. I have no affiliation at all. I'm just a satisfied customer for the past 13 years who is happy to buy a license with my own money every year.
The comparison matrix for community and ultimate editions makes it clear: You cannot deploy in IntelliJ without a licensed copy.
You can create a WAR file and deploy it manually to Tomcat or Glassfish if you wish. Why not just do that?
I will compliment you on how you are approaching the problem. IntelliJ, Maven, and your other choices are very good.
If you feel up to the challenge, you can look into Spring Boot. You can run an executable JAR and leave Java EE app servers behind. IntelliJ community can easily run a Spring Boot app.
Choosing Spring Boot does mean leaving EJBs behind. Everything you can do with Java EE is available in Spring Boot. You'll be using POJOs.

Which .JAR do I use to embed Jetty?

I'm at the point in my application where I would like to have an HTTP Server embedded into my project that updates the page in real-time using AJAJ(Similar to AJAX). However, I have no idea where to begin and the amount of tutorials on this subject are fairly limited, so I decided to go with a name that I've heard quite a few times before, Jetty
So, I downloaded Jetty and read through some documentation, and I'm staring at their beginner tutorial asking myself, "Which one of these f*kin jars do I use?" There's like 9,001 of them. Not to mention that there's like 1200 folders that all contain 1500 more jar files each.
Okay, I'm over exaggerating, but take a look.
It's fairly, uhm... confusing. This is much different than most libraries that are a single jar file, this is just... insane.
Anyway, I'm trying to figure out what all I need to be able to use JQuery, AJAX(AJAJ), and basic HTML features.
I'd suggest you to start with this simple tutorial and jetty-all jar
Embedding Jetty Webinar recording
Embedding Jetty docs
jetty-all different versions downlad
To followup on Gas's answer.
jetty-all doesn't have 100% of Jetty.
It used to, hence the name.
However, today its impossible to have 100% of jetty, as many components can conflict with each other.
If you use maven, or gradle, or ant+ivy, then you'll likely want to depend on:
org.eclipse.jetty:jetty-webapp
org.eclipse.jetty.websocket:javax-websocket-server-impl
let the transitive nature of those build tools pull in the rest.
This would get you "started" easily enough.
There are also plenty of example projects that use embedded jetty.
See:
Embedded Jetty: with JSP enabled
Embedded Jetty: with various WebSocket configurations
Embedded Jetty: using Servlet 3.0 features
Embedded Jetty: using Servlet 3.1 features
Embedded Jetty: various Logging configurations
Some use 100% embedded jetty (without a war file, or WEB-INF, or web.xml), some use a war file built elsewhere.
Jetty uses maven so it can participate in the global central artifact repository, and that we have 2 developers on Jetty that are also developers on Maven.
If you want to manage the dependencies yourself, then you will need to know intimately the purpose and role/purpose/relationship/requirements of every jar file that you are going to add into your project. (and answering that is way out of scope for stackoverflow)
You have many build tool options to make managing the dependencies easier:
Apache Maven
Gradle/Grails
Apache Buildr
Apache Ivy (an add-on for Apache ant)
Groovy Grape
Scala SBT (for working with Scala on top of Java)
Leiningen (for working with Clojure on top of Java)
Maven isn't required, you could use any of the above tools.
Tip: Maven and Gradle are the best integrated in various IDEs (like Eclipse IDE and IntelliJ)

Modify Java classes from Eclipse in running servlet?

I have a multi-module Maven project that is a Java web application. I am using Eclipse as my IDE and am wondering if there is anything in WTP that will allow me to add/delete/modify Java classes without doing
"mvn clean install" and,
restarting the application server?
Edit: I've seen JRebel and watched some videos, but it doesn't support CXF or GWT and it seems to me that Eclipse/WTP should do something like this out of the box, yes?
JRebel does support CXF and GWT - refer to the features page http://www.zeroturnaround.com/jrebel/features/frameworks/
Most web containers allow you to perform hot code replacements but there are a number of limitations, such as:
Changing the class/method signature will not work - you have to redeploy and restart
Changing a "stack frame" call (e.g. Main) generally will not work either.
Check out this link for instructions on how to set it up for WTP.
Check Dynamic Code Evolution VM (DCEVM). You do not need to install anything specific in eclipse. Check if it works with CXF. GWT already supports hot deployments in hosted mode, with some limitations. For example, if your server is Jboss, check this.

where we put ejb program in tomcat 6.0 and how to deploy?

I do not have eclipse. and I am having Tomcat 6.0.I write the programs in notepad. and I was successfully run the servlet programs. but I am not know about EJB. that is "where we put the .class files(In which directory)?". and "how to run and how to deploy the EJB programs?" please give sample example. please help me.
Tomcat 6.0 is not an EJB container. EJB's are a rather advanced topic. Do not haste into it. You can jump a mighty long way with servlets without ever needing EJB's or EJB containers.
If you need more services to base your app on, look at Spring, which offers (almost) everything an EJB capable container offers and allows your programs to run on Tomcat 6.
Also Java is a bit verbose to use notepad for non trivial projects. You might consider to upgrade to an environment which gives better support. I am partial to IntelliJ myself, but netbeans and eclipse are nice too for that kind of development.
If you like to stick to notepad approach, you might take a look at grails. It offers all the services but uses groovy as the programming language which makes things a lot more compact allowing to develop JVM based web apps using a lean editor.
You can run only web applications with Tomcat . For application s developed using EJB Use JBOSS. But JBOSS may be very slow. So while development use glassfish. Tomcat is only for jsp and servlets. When it comes to EJB its enterprise application and have to use EJB container like JBOSS or some other EJB container.

ide and application server for java

Which is the best application server and the best ide for an absolute beginner for locally hosting servlets
One good solution is Eclipse + Tomcat.
Check this screencast for further information.
Eclipse and netbeans each have a distribution that includes all you need for Servlet development, including a server.
Between the two, eclipse is the more powerful, but for a beginner it could be a bit overwhelming. Netbeans is less configurable, but that also means there's less to distract you from the "normal" way of doing things, which is probably the best for a beginner.
I'd recommend NetBeans + Apache Tomcat/Jetty is you're just looking into servlet development. If you plan to do some EJB3/3.1 development as well have a look at Glassfish or JBoss AS.
NetBeans integrates great with all of these and requires far less configuration than Eclipse to get you started.
You might consider as an IDE option IntelliJ IDEA as well, it's heavier that Eclipse and NetBeans, but it has some compelling features of its own...
I recommend using Eclipse Java EE version, together with JBoss Application Server. You can download Eclipse plugin: JBoss Tools which adds alot of nice plugins to Eclipse.
You can download JBoss AS (Application Server) for free.
All products are free and opensource.

Categories

Resources