I recently released my old, long-term project called survey-rocket (a simple online survey tool) to google code. I started to refactor the code to make it more readable and maintainable. Although I invested many hours, there is still a long way to go until it can be considered good code. Basically I used this project… Continue reading My first open source project
Tag: Java
Add tools.jar to maven repository
A way to fix the following error: 6/23/12 1:50:22 PM CEST: Missing artifact com.sun:tools:jar:1.4.2:compile The tools.jar is part of all JDK’s and therefore there is no need to fetch this dependency from any repo. Therefore the easiest thing is to add this jar to the local repository. Locate the tools.jar in the JDK and run… Continue reading Add tools.jar to maven repository
Comprehensive tomcat installation how to
find it here
persitsing an interface type with JPA
Consider this scenario. You have several classes implementing the same interface and you’d like to persist this interface type within an entity. The JPA is not able to handle that, but there is a workaround! Lets make an example: A Plate (entity) has the attribute of type Fruit (interface). The apple, orange and the banana… Continue reading persitsing an interface type with JPA
Set URL of Tomcat Webapplication to ROOT in Eclipse
When you create a Dynamic Web Application in Eclipse and run it on Tomcat, the Website will be available trought http://localhost:8080/[PROJECT_NAME]. To “move” the application in the root (making it accessible on http://localhost:8080), go into the project’s properties, go to “Web Project Settings” and just enter “/” in the Context Root textbox. Done.
Simple multithreaded Java Webserver
The following code (estimated 150 lines of code) implements a simple multithreaded Web Server in Java. The code is easy to read and contains no (really) complicated stuff. There are 5 classes: HTTPException.java This class extends Exception and overrides the getMessage(String) Methode, which is responsibe for example for the Error 404 Not Found message. MimeTypeResolver.java This… Continue reading Simple multithreaded Java Webserver
Sort collections in java
Usual problem: When you pass a java list to Collections.sort(List list), the elements are sorted according to their returned values retrieved by calling the objects compareTo() methods. Well, what to do if you suddenly want to sort the same list by another criteria? Then a comparator is your friend. A comparator knows how to compare… Continue reading Sort collections in java
get sun java on debian based system
just type: sudo add-apt-repository “deb http://archive.ubuntu.com/ubuntu hardy main multiverse” sudo add-apt-repository “deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse” sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner” sudo apt-get update sudo apt-get install sun-java6-jdk