Log in

Java developers

Recent Entries

6/9/14 03:20 pm - underscorer - Need help again

I'm following this tutorial on the netbeans website for a simpleEE7App. I followed the instructions precisely but got an exception need help. :/


Screenshot (35)

6/6/14 10:29 pm - underscorer - i need help

anyone here?

4/4/14 02:50 pm - banana - Always something new to learn

It seems that you can override a concrete method and make it abstract. I actually came across some code that did this, so I had to check how it worked. Consider the following:
abstract class Grandfather
   protected String speak ()
      return ( "I'm old" );

abstract class Father
   extends Grandfather
   protected abstract String speak ();

public class Child
   extends Father
   protected String speak ()
      return ( "I'm young" );

   public static void main ( final String [] args )
      System.out.println ( new Child ().speak () );
It prints "I'm young" (unsurprisingly) but the interesting part is that despite Grandfather defining a speak method, Father is forcing Child to re-implement it. Grandfather's speak method can't be called by Child because Father has made it abstract. I had to test that this worked by commenting out some of the speak methods. It really is the case that Grandfather has an implementation but Father doesn't.

10/21/13 04:43 pm - banana - Heads up for people who write webstart or applets


You used to be able to sign your code with a self-signed certificate. It's close to not signing it at all, but the user could then agree to trust you for ever more. I have a few webstart apps publicly available, and more at work. Soon they will stop working. My choices will be:
  • pay hundreds of dollars for a proper certificate (extremely unlikely)
  • persuade the users to install "Deployment Rule Sets" to allow my stuff to run (almost as unlikely)
  • get the users to run the code locally without webstart (completely insecure, and I'll probably need to make an installer)
I don't see who wins here.

7/12/13 09:45 am - n5iln - Random Question

Okay, Geek Trust. I posed this on my personal LJ, but this seems like a good place to mirror the question, so I'll ask here too.

The opinion has come across my screen that most programmers don't utilize more than 40% of a given language's capabilities. Is that estimate low, high, or pretty much spot-on?


7/17/12 04:50 pm - banana - WebStart/JNLP question

I have set up some WebStart apps which work fine except for one thing: they never check for updates, despite me setting the relevant options (as far as I can tell).

The shortcuts that are installed for the user have the option -localfile. This isn't documented anywhere I can find, but it seems specifically to prevent WebStart from checking for updates. If I remove this, there's an update check every time.

Any suggestions?

I'm reading JNLP docs here: http://docs.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html
An example JNLP file is here: http://j_banana.users.sourceforge.net/ws/retest/retest.jnlp - right click and save to prevent the app installing and starting up.

Edit: I think I found the problem. Looks like <shortcut online='false'> causes -localfile and <shortcut online='true'> doesn't. I was assuming that that attribute meant "only run on line", but looks like it doesn't. The JNLP docs linked above doesn't seem very clear on this.

7/8/12 11:37 am - raydac - a MindMap to tune the Java Performance

It is presented as a big PNG file (1 Mb), based on presentations of engineers of Oracle's SPb (Russia) branch and some information from the internet

6/1/12 08:35 pm - banana - Looping backwards

I just came across a nice syntactic trick for looping backwards over an array:
public class Decr {
   public static void main( String[] args ) {
      char[] array = { 'a', 'b', 'c' };

      // Traditional way
      for ( int i = array.length - 1; i >= 0; i-- ) {
         System.out.println( array[ i ] );

      // "Start at the end, i goes to zero"
      for ( int i = array.length; i --> 0;  ) {
         System.out.println( array[ i ] );
It might look as if I invented an operator, but i --> 0 would normally be written as i-- > 0

BTW, what happened to java_dev? It used to be lively here, but no one posts any more. Did all the Java developers leave LJ?

12/5/11 12:42 am - raydac - Multi-pass Java Preprocessor with ANT and Maven support

Helllo all, I am glad to notify you that I have published the new very deep refactored version of my old JCP preprocessor for Java, nowadays it supports ANT  and Maven but also can be called  through CLI. I have used the product for dozens of projects as a code generator when I was involved in mobile development. It is a multi-pass preprocessor with loop support, it saves its directives in comment lines so you can use it with any popular IDE. It is an open source project.

11/30/11 12:51 am - ska_o - PNG metadata

Does anyone know of a way (hopefully a simple way) to add metadata, especially non-standard tags, to a PNG file? I'm working on a project that involves using a lot of high-bit-depth B&W images from a microscope, and the best format so far seems to be PNG. The camera produces uncompressed TIFF.

I've mostly been working with ImageJ for this project but had to use a little workaround to convert to PNG correctly.

Anything with lossy compression, such a JPEG, will not work. PNG is very convenient but I haven't figured out the support for metadata.

Compressed TIFF may also work, although compression is probably worse, and I'm not totally sure it's going to be easy to write the non-standard tags.

Any advice?
Powered by LiveJournal.com