Java Persistence API (JPA) – Cannot find annotation method warnings

Playing around with the JPA, got this error when I added a reference to my persistence layer in a console app.

Read more No Comments »

Setting a private static field in Java using reflection

Needed to set a private static class variable for some unit tests I was writing for a small Java project today. Here is how I did it.

Read more No Comments »

Example of a JUnit test in Netbeans

A quick example of how to write a unit test with JUnit in Netbeans.

Read more No Comments »

Read a URL in Java

A simple method that reads the HTTP response from a URL request and returns the content as a string in Java.

Read more No Comments »

Enumerate a HashMap in Java using Iterator

Shows how to enumerate over a HashMap in Java by getting it’s keys and using the Iterator generic interface.

Read more No Comments »

Select one to launch blank screen when creating MIDlet in J2ME

Was playing around with J2ME in NetBeans for the latest module of my Open Uni course when I got this rather wierd error when creating a class derived from javax.microedition.midlet.MIDlet.

Read more No Comments »

Byte array to String in Java

Shows how to create a string from a byte array in Java.

Read more No Comments »

© 2017 Garry Passarella. All Rights Reserved. Facebook Twitter Twitter