Server side Java - where to start [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm really starting to get a hang of the client-side Java programming, and from what I understand Java is great for developing stable server sides for large amounts of traffic.
The problem is that I'm completely new to server development, so I don't know where to start or where to look for information, despite Java's good documentation.
More specific questions:
Do you know any good, non-specific tutorials for server-side Java? I've seen some tutorials for Google's Cloud Platform and Netscape, but I don't want to be dependent on their infrastructure.
Is the common practice to develop your code in Eclipse and then "ship" it to your server? As I said I've never done server-side development and I've only tried learning a little node.js.
Thank you in advance, I hope these questions aren't to wide-scoped.

I would suggest you to start with a simple setup like you already told us: Eclipse + let's say an easy to use tomcat.
If it comes to the server side you need to create a Servlet which allows to access other application data from your server in a format which you define or let's say you + the clients define. I would suggest you to start with something you will be familiar like Json. For this I have a little "starting point" for you.
Clone that simple example for a server-side application:
https://github.com/DominikAngerer/java-GsonJerseyProvider
It already provides you a simple structure for Json which is used by a Framework like Ember and also you can easy modify the structure which is defined there.
Is the common practice to develop your code in Eclipse and then "ship" it to your server?
Yeah it's totally common to do that. Write your Server Side code and export it as .war - tomcat or jetty for example can simply deploy them and you will be able to run them on these application server.
Do you know any good, non-specific tutorials for server-side Java? I've seen some tutorials for Google's Cloud Platform and Netscape, but I don't want to be dependent on their infrastructure.
I really love to work with Jersey - It's really a to understand the code you will write. Maybe try the example provided by IBM developersworks: http://www.ibm.com/developerworks/library/wa-aj-tomcat/
For the beginning it may be a little of a overhead but after you tried the example (it should be running right away) I think you will get the idea of how to create a simple backend system with java.

If you want a complete environment out of the box, you can try:
Netbeans EE IDE:
It contains a GlassFish server and the SDK preconfigured, glasfish is one of the most used open source application servers. Here you can find tutorials from the Netbeans page.
JBoss Developer Studio: is another very used IDE that includes a JBoss server. You can find tutorials from this one here.
I would sugest to start with GlassFish, as it is very easy to use and configure.

Take a look at JavaEE. I would start by learning how to create simple JSP pages with Eclipse + Tomcat (create a "Dynamic Web Project"). After that, check out Servlets and be sure to understand HTTP. After that, I would get an overview of JSTL and other Java EE components. DZone has a nice refcard giving you an overview of the Java EE 7 components.
After that, you should be good enough to move on to a framework like Spring or Struts. Alternatively you can perfect Java EE fully learning it's more advanced components like CDI(context dependency injection) or JAX-RS and JAX-WS(web services). This document should give you an overview of how to configure a servlet container in eclipse: http://www.eclipse.org/webtools/community/education/web/t320/Configuring_an_Application_Server_in_Eclipse.pdf
As for tutorials, check out Oracles JavaEE 7 tutorial at: http://docs.oracle.com/javaee/7/tutorial/
Alternatively, if you do not like the styles and patterns used in Java EE, there is a non-Java EE framework called the Play Framework (http://playframework.com) it gives you the option to develop your application using either Java or Scala, and uses MVC architecture.

If you want to learn server side programming with JAVA, I recommend to start working with Eclipse. Almost all developers whom I know are using one or another IDE, most of them are using Eclipse for J2EE.
There are plenty of tutorials available on how to setup eclipse on your local computer. I personally read many tutorials when I learned it, you can google it.
http://www.apekshit.com/t/11/Writing-JAVA-programs-in-Eclipse
http://www.apekshit.com/JSP-Tutorial-for-beginners-with-Examples/c/21
I found these 2 that might help you to achieve what you are looking for.

Related

Moving from Swing to Web Applications

I am decent (or so I like to think) when it comes to making java swing applications, but I want to make the jump to web applications.
The problem lies with the fact that there's so much going on and so much different terminology being thrown around. I have no idea where to begin and it seems very daunting.
I've read up on a few things such as JSP and GWT, but I still can't seem to be able to make the jump. My question is: is there a specific flow used when making a web application to make everything seem to connect better, and if possible, could you recommend a good starting point for someone like me that comes from a solely desktop gui environment and wants to start developing web apps? Thanks for the help!
Both Swing and Web application still rely upon java keywords and terminology. java web technology work better when you use a framework . I suggest you start with Spring. It has MVC library that you can use, plus spring mvc has a large community online. However, Java Servlet is quite similar with what you have learn in java.

What to do when you want to create your first java web application? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
So i want to create my first web application. But there is simply too mush choose to know where to start i keep jumping from one thing to another.
The first thing is which ide should i use:
is one better for web development than another or is it just personal choice?
Currently i'm using netbeans and i can see that all the samples are using glassfish.
Should i use glassfish first? or should i look at tomcat, jboss,...
When i use a glassfish example and switch to tomcat server some classes are not recognized anymore. Does every server has it own classes ?
When i followed a spring tutorial it used tomcat but can it also be used with glassfish ?
Is there a big difference in cost between servers ?
What about jsp or servlets
a lot of examples use jsp some other prefer servlets what is still used nowdays ??
i also came across some websites where they prefer freemarker instead of jsp / servlets but is it not better to learn to work with jsp and servlets ?
And what about frameworks
is it better to use frameworks like spring to begin with as beginner or not ?
And build tools
Should i use build tools like maven,ant ,gradle ? or would it be overkill in the learning curve ?
And how are java web application stored on servers ?
I now normal website with html css and js you just need to drag all the files to the server and it is working. But what about java webapplication does it works the same way ?
All i want to do is start simple and build up from there. But i really need some directions on whats best to learn first and why.
May be a too broad question, but to keep it simple:
If is your first app but is not only a little test:
Frameworks
Spring
Hibernate
Maven
JDBC
Server
Tomcat
Database
MySql
Readings & Tutorials
How to connect Tomcat with JDBC and MySql
Spring MVC hibernate
Spring Tutorial
There is no universal answer, it all depends on your needs.
If you're already familiar with a Java IDE, you should probably stick with it, NetBeans sure will be sufficient for EE development.
For servers you should look at one issue:
If you need more than the web profile of Java EE (Java EE 6 Web profile vs Java EE 6 Full Platform), you need an application server like Glassfish or JBoss(WildFly), as Tomcat doesn't ship with the full Java EE profile. Otherwise you should find enough documentation on any of them. I personally use JBoss 7.x / WildFly 8 and never had an unsalvageable problem.
Both Servlets and JSP are already a bit oldfashioned, I would recommend JSF, if you want to build a larger application with clean code separation. But knowing the basics of Servlets or JSP helps with beginning JSF.
As of Java EE 6 / 7 I recommend sticking to the standards. E.g. using CDI or EJBs instead of Spring and just use standard JPA, that way you can always change your JPA-Provider or Webserver without many code changes, if you're experiencing some troubles. Hibernate is a good choice for JPA, but EclipseLink may do great as well.
If you do that, most of your code will be independent from your chosen server. What remains is configuration, which differs from server to server, but is only needed at the beginning in most cases.
Build and dependency management tools like Maven help a lot, but are not mandatory for the beginning. Note: They may require a special directory stucture, so it's better to start with a skeleton project.
As to how to deploy web applications, you normally package them (for example as WAR - Web Application Archive) and then drop them in your server's deploment folder.
To keep it simple to start and slowly to digest, I would recommend
basic hello world web application using
Spring Web MVC,
Netbeans as IDE,
Tomcat 7 as your server.
then you can jump on to Database integrations and then explore on hibernate.
For database you can use MySQL.
Related links:
(Spring MVC)
http://www.mkyong.com/spring3/spring-3-mvc-hello-world-example/
(Spring MVC, Hibernate, MySQL)
http://www.mkyong.com/spring/maven-spring-hibernate-mysql-example/
Vaadin
An alternative route to being a Java-based web app developer is to use Vaadin.
Comes in two editions:
A Java-based server-side web app framework (for Java programmers)
Web Components-compatible pieces (for JavaScript programmers)
The first is for Java-savvy developers who want to develop professional-looking sophisticated "single-page" web apps without having to know about the web technologies (HTTP, HTML, CSS, DOM, JavaScript, Ajax, Comet, Push, WebSocket, and so on). All those web-standards technologies are used at runtime, but behind-the-scenes, transparent to you as a Java programmer.
With Vaadin, the Java developer says “I want a layout to hold some widgets on screen, and those widgets should be this button, that button, a couple of text fields with labels, and a data grid.”. Vaadin automatically, at runtime, generates the necessary HTML+CSS+JavaScript+etc. to render that UI remotely on the client (any common web browser).
When a user clicks one of those buttons, or types in one of those fields, your Java code running on the server-side is automatically notified of that event. Your code can react by running business logic, saving data to a database, connecting to a web service or other data source/sink… all executing on the server-side without any involvement of the client/browser.
Vaadin is implemented internally as a Java Servlet. It runs on any web container with Servlet technology, such as Apache Tomcat and Eclipse Jetty. You may choose to selectively add libraries from Java EE to that container. Or you may choose to use a full-blown Java EE server such as Glassfish. If you like CDI/Spring, Vaadin can work with that too.

Java for Software Developers [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am a .NET developer (and have been for a while now). I work for an organization that was just recently acquired by a larger company whose primary development language is Java. There are a few .NET developers, but the ratio of .NET to Java has decreased substantially now that the teams have merged.
That being said, I've decided it would be best for me to start Java development. However, most of the books I've seen so far for "learning Java" all take a very basic approach (what is a class, OOP principles, etc etc). I am comfortable with this part of development and don't need a primer (unless there are differences so profound that someone recommends the fundamentals from a Java perspective...).
Anyway, I'm looking for a book recommendation for Java development from a software developer's perspective that discusses today's techniques. For example, MVC architecture, application best practices (I am a web developer, this includes web services), is it worthwhile to work with JSPs or consider Ruby instead, etc etc.
A HUGE bonus would be "learning through doing". Something like Murachs, where I can step through a project from start to finish, and is light enough on fundamentals that I don't get bored. I'm hoping to walk away with enough basic knowledge to volunteer for some internal projects and grow from there.
I'm sorry if my question is needlessly broad, but I'm struggling to find a starting point aside from my Eclipse installation (I am doing this on Ubuntu, deliberately avoiding Windows).
Thanks for any direction or insight you can offer.
EDIT - After discussing with a co-worker, and reading Bert's great suggestion (all of them have been excellent, thank you all very much), it turns out the main focus is on EE, and Glassfish. They use NetBeans for development, since it is tightly bound to Glassfish.
This doesn't mean much to me, except that I think the parallel drawn is IIS/Web apps to Win32 apps. But perhaps it will help clarify some of the more open-ended questions in my OP.
Effective Java By Josh Bloch
It may not be "learning by doing" but it gets into the details of how to use the Java language effectively.
I would then complement it with Java Puzzlers by Josh Bloch and Neal Gafter
My best bet is to learn Spring based on your requirements:
MVC architecture, application best
practices (I am a web developer, this
includes web services), is it
worthwhile to work with JSPs or
consider Ruby instead, etc etc.
You can start by visiting SpringSource at http://www.springsource.org/
There are a few points I would like to make to you:
The basic Java language is rather small and C-ish. To my understanding C# and Java works almost identically here.
The Java runtime library is VERY, VERY BIG, and rather unlike C#. Very few people know all of the Java 6 runtime library well.
There are several IDE's in common use for Java. You will want to learn the one used by the rest of the team.
I would suggest having a brisk walk through the Oracle Java Tutorial, just to get the hang of the spirit and do some of the exercises, and then look at the common "Java for C# programmer" cheat sheets on the internet. Then do a lot of code, and then read Effective Java.
(For those who think they know Java 6 runtime well, please consider if you are familiar with RMI, the Rhino Javascript engine, and XPath in the XSLT implementation and all the rest)
Please look at the following thread:
https://stackoverflow.com/questions/75102/best-java-book-you-have-read-so-far
Ruby makes no sense unless you're writing JRuby on the JVM.
If you're writing web apps, you'll need to know JSPs written using JSTL (JSP standard tag library), servlets, HTML, CSS, and JavaScript. Download Tomcat from Apache - it's a servlet/JSP engine that will let you deploy web apps locally for learning. It has an HTTP listener built in, so you don't need IIS or Apache.
You'll need to know how to create and deploy a web archive (WAR) file. That's a ZIP file that contains the standard format for a web application.
I'd have a look at the Tomcat "first web app" docs to get a feel for it.
Once you have that, come back and talk about frameworks. (When you do, I'll recommend Spring.)
Here are some references I like. I'm sure there are better, but there are the ones I have read and can vouch for:
Java in a Nutshell is a classic summary of the core language. If you need more, there are books like Java for Programmers for programmers transitioning to Java (I have not read it).
Sun's Core Servlets and JavaServer Pages was a good book for Java servlets and JSPs. But consider that a lot of web tech is built on top of this (e.g. Spring), so this may be giving you foundation but not direct knowledge of the specific framework you will be using. Also a lot of web tech these days are client-side/JavaScript/AJAX-based, e.g. jQuery.
As for MVC, consider focusing on MVP instead. I been playing around with Google Web Toolkit to leverage my Java background to create client-side apps, but it is also a good way to get some idea of MVP - read Large scale application development and MVP Part I and Part II, and the GWT MVP Development with Activities and Places. However, GWT keeps evolving.
My last suggestion is that you narrow your focus - try to figure out what frameworks are popular at work and decide if you want to focus on a tier: front (e.g. HTML/CSS/jQuery), middle (e.g. Spring), or back-end (e.g. Hibernate). Once you figure this out, then post a more specific question(s) (e.g. what are the best resources for learning XYZ).
Just from my experiences with java (limited but I took a Web Dev course teaching JSP's) Any decent technology for it is usually 3rd party. However, from what I can tell when doing web dev I would use Netbeans, Netbeans has Tomcat built in especially in Ubuntu for easy debugging.
More on similar lines you can find answers from this post
https://stackoverflow.com/questions/3820437/life-after-head-first-java/3820449#3820449
The Java landscape is quite wide as you probably have already figured out.
There are hundreds of frameworks and tools that can be used for basically doing the same thing. To get an idea, you can take a look at this presentation written by Matt Raible, where he compares a number of Java web frameworks.
As someone else suggested, you should definitively take a look at the Spring Framework. It is widely used in the enterprise world. There are several good books about Spring.
If you want to get the basics of Spring MVC in a "tutorialized" style, you can take a look at this book. It doesn't cover the latest Spring version (3.0) and it is not a "perfect" book, but it should allow you to get the basics while running some examples.
Also, there are literally thousand of Spring-MVC tutorials on the web.
For instance, you can take a look at:
http://www.adobocode.com/spring/a-spring-web-mvc-tutorial
RESTful services are also quite popular these days. I have been working with the Resteasy framework from JBoss and I found it very easy to setup and work with. This book explains the REST architecture and uses Resteasy as framework for the examples.
I also recommended "Head First Design Patterns" from O'Reilly. It covers the most important patterns using Java and it will help you to see how the language can be used for patterns you may be already familiar with.
One more suggestion: you may considering "tuning in" on Java TV. It's a great resource with hundreds of Java tutorial videos. It covers a wide spectrum of technologies so you should be able to find something for you.

Beginning Java Web services. Where to start

my company runs a site that primarily has its backend logic coded in Perl. It works fine but ultimately we are headed to something Java driven. I do plan on studying this and would like to start setting up a Java environment on another server in our company so when the time comes I at least have a headstart.
Does anyone have a recommendation on where to begin? Just interested in generalities now.
JW
What are you planning to study? All Java or just the web service extensions?
If you come from Perl, I must suggest you starting from "hello world" with a Java cookbook, then you can start moving towards web services after a while.
Another good book about web service is what you might need.
Finally, when beginning to build the web service, I suggest you two things:
Design the WSDL independently from Java code that will implement it. It's very important for cross-platform interoperability. Try to use Altova XMLSpy or a similar tool to define the pure WSDL as a design contract
Deploy with Axis
I don't know how to propose to move this question to Stackoverflow, because you can find LOTS of answers there
You need J2EE
http://download.oracle.com/javaee/1.4/tutorial/doc/
Java Tutorial
http://download.oracle.com/javase/tutorial/
General Java Stuff
http://www.oracle.com/technetwork/topics/newtojava/overview/gettingstarted-jsp-138588.html
http://www.oracle.com/technetwork/articles/javase/webapps-1-138794.html
About the Class Path
http://kevinboone.net/classpath.html

Best IDE for developing java web services (for beginners)

I am trying to learn how to work with java webservices, but i had some issues working with eclipse bundeled with some incubated modules, which give me some errors while trying to program something.
Can you suggest me an IDE for developing java webservices, which would be easy to use (or which eclipse package...), especially for beginners.
It would be grate if you could maybe also point me some tutorials of how to create a simple java webservice step by step. The ones that if ound where kind of "old" 4-6 years ago.
I just went through the same process, and didn't have many problems using eclipse. Once you get past the initial learning curve of setting things up, it's really not that bad :)
Here's some of the sources I used to learn how to build JAX-WS services:
http://download-llnw.oracle.com/javaee/6/tutorial/doc/?wp405739&JAXWS.html#wp72279
JAX-WS/Java EE tutorial from Oracle, updated June 2010
https://metro.dev.java.net/getting-started/basic.html#Building_Server
This gives some useful code snippets whether you are starting from Java or from a WSDL file.
http://www.ibm.com/developerworks/java/library/j-jstl0211.html
Information on JSP tags and the JSTL standard libraries. (these are super useful when writing the JSP pages your user will end up seeing)
http://www.stardeveloper.com/articles/display.html?article=2001081601&page=1
Information on JSP scripting tags and custom tags in general.
http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/
JSP code conventions/best practices
Try Java EE 6 examples with Glassfish. They are relatively fresh and Glassfish has an excellent support for almost all parts of the spec
http://download.oracle.com/javaee/6/tutorial/doc/bnayk.html
With eclipse and axis look at this:
http://ws.apache.org/axis2/tools/1_2/eclipse/wsdl2java-plugin.html
I'm using NetBeans, and haven't had any problems with it so far!
You can download it here: https://netbeans.apache.org/download/index.html

Categories