Tag Archives: Java SE

How to create a Web Application Project with Java/Maven/Jetty or Tomcat


via How to create a Web Application Project with Java/Maven/Jetty | Guru.

In this article, we create a simple web application with the Maven Archetype plugin. We’ll run this web application in a Servlet container named Jetty, add some dependencies, write simple Servlets, and generate a WAR file. At the end of this article, you will also be able to deploy the service in Tomcat.

System requirements

Add Spring dependencies to a Maven project


via Add Spring dependencies to a Maven project | Easy Java SE.

In my previous post I described how to begin to create Spring MVC web application using Maven on Spring Tool Suite. This post is also related to previous post and here I’m going to move with add Spring nature to the project that I have created in last post. This is very simple.

JDK 9 REPL: Getting Started


via JDK 9 REPL: Getting Started – Miles to go 2.0 ….

Conferences are a great place to meet Java luminaries. Devoxx France was one such opportunity to meet Java language architect, ex-colleague and an old friend – Brian Goetz (@briangoetz). We talked about JDK 9 and he was all raving about REPL. He mentioned that even though there are a lot of significant features, such as modularity and HTTP2 client, in Java SE 9, but this tool is going to be talked about the most often. The statement makes sense since it will really simplify exploration of Java APIs, prototyping, demos in conferences, and similar tasks a lot simpler. This blog is coming out of our discussion there and his strong vote on REPL!

Read-Evaluate-Print-Loop has been there in Lisp, Python, Ruby, Groovy, Clojure, and other languages for a while. Unix shell is a REPL which can read shell commands, evaluate them, print the output, and goes back in the loop to do the same thing.

Java Multi-threading Made Easy – Expensive Object Pool


via Java: Java Multithreading Made Easy – Expensive Object Pool – CodeProject.

Since Java SE 5.0, developing multithreaded applications became much easier due to the task executor framework. Instead of working with low level synchronization constructs, the framework introduces the concepts of Task and Executors. It also provides isolation between task submission and task execution, allowing to easily change execution policy without even touching submission logic. Still, it doesn’t save you from creating race conditions and other difficult to debug and discover bugs, so in order to use the framework to its full power, I recommend starting from basics. A great book that covers almost everything you need to know about multithreading in Java is Java Concurrency in Practice by Brian Goetz and it’s a must if you are developing in Java. In this article, I will show you how to create a useful utility class for managing a pool of expensive objects, and how simple it is to create complex structures by reusing what Java offers.

Imagine we are writing an online multiplayer game and we want to offer several players to play together a procedural generated level. Since the level generation is a very expensive operation, we do not want to affect our players experience and having them to wait too long for it to complete. Instead, we want to maintain a pool of already generated levels that we can offer immediately. Also, we want to support parallel creation of additional levels to maintain our cache full. With these things in mind, let’s create a reusable component that supports the operations we need.

Generic Classes in Java


via Generic Classes in Java Example | Examples Java Code Geeks.

This article shows creating a generic class. Java generics were introduced with Java SE version 5.

Some commonly used generic classes are defined as collections in Java API; for example the ArrayList. The API javadoc documentation shows the ArrayList definition as public class ArrayList (where E stands for an element type). Generics added the compile-time type safety and eliminated the need to cast when reading elements from collections.

Java Updates: SE 8 update 31, SE 7 and SE Embedded


via Java Updates: SE 8 update 31, SE 7 and SE Embedded (The Java Source).

Oracle has released Java SE 8 Update 31 and Java SE 7 Update 75 and 76. Also available are new Java SE Embedded updates. Developers can download the JDKs and JREs for Java SE and Java SE Embedded at the Oracle Technology Network.

Java Brain Aerobics (The Java Source)


via Java Brain Aerobics (The Java Source).

Do you know Java tip or trick that you’d like to share with Java Community but don’t want to give away too easily? Write a Fix This code challenge for Java Magazine. Give readers the chance to flex their brain muscles, have fun, and learn something new. Can you stump the Java world?

Java Magazine reaches more than 250,000 subscribers and is loaded with technical articles, community news, and success stories from an array of businesses. The magazine’s success is the result of the expert writers who write about technologies that they have first hand experience with.

Pick a topic you are most familiar with and send as many Fix This challenges as you want. The challenge can be about any Java technology, whether it is Java SE, Java EE, Java ME, or Java Embedded.