tags:

views:

135

answers:

3

What's the fastest way to draw a Hello World on the screen as a GUI in Java,

1- by using the minimum number of classes.

2- with the least byte code executed

2- the JVM tweaks

so when I double click on the Jar file in Windows, the Hello World appears in no time (assuming the Runtime is not already loaded).

+2  A: 

If you're optimizing for runtime then pre-render an image with the text "Helo World" and then use Java to display it as an image. You can use ImageIcon to easily display an image.

Steve Kuo
+5  A: 

this is the fastest graphical Hello world i could get.

public class HelloWorld{
    public static void main(String[] args) {
        javax.swing.JOptionPane.showMessageDialog(null, "Hello World");
    }
}
medopal
lol that's the best answer! Never thought to do it like that.
Mordan
you even get the icon on the message box as bonus :), actually as the guys in the comments said, the main libraries are not too small, so even the smallest application will need few seconds
medopal
A: 

Hello World! in 70 Bytes

http://java.sys-con.com/node/37060

asela38