Free Java Game Code: HangMan Code by Java!

I’ve coded a simple Game by Java – A HangMan Game! To make it interesting, The game is called HangCoder which means, it is played by a programmer! Don’t worry, it only means you will be given words related to programming to guess.

The source code is open and allowed to modify. It is helpful as a quick demonstration of java Swing and AWT components like textboxex, buttons, images and other stuffs. Study the code, modify as you need and make your own Java HangMan!

Download Source From here.

Images: Can be obtained from here (no need to download if you get the zip file above)


Automatic Mouse click, Key Press Script in Java

By Java, you can perform automatic mouse clicks, keyboard press etc. 🙂

I’ve created a short application by which you can make automatic mouse click in a certain co-ordinate! 😉

Download Source/Executable

Download from GoogleCode (source/executable)

Please note:  This is not any professional application, if you want to use professional mouse-recording or macro-recorder for presentation or other tasks, use other software.

If you want only to run the executable file, run the .jar file. You must have JRE installed in your computer 😉

How it works?

Java has a class Robot which dedicated for performing these activities. I simply used the class. More documentation here, and analysis the source code uploaded.

How to Install Java JDK & Netbeans in Ubuntu

Every time you make a fresh installation of ubuntu, you need to download large software packages again. So the best way to save time is to download the installer files and store it in a different hard-disk drive. Later, we can simply double-click the installer file to install the application!

This tutorial is not only for Ubuntu Netbook remix. It can be used at any version of Ubuntu 🙂

1. Install JDK

We will use OpenJDK as your default JDK. JDK is needed to develop applications in Netbeans. Alternately, you can use Sun JDK

To install OpenJDK, type in terminal:

sudo apt-get update
sudo apt-get install openjdk-6-jdk

2. Download Netbeans from Official Site

Now we will download Netbeans. Go to Download link below:

Download page. Choose options you need.

3. Install

When download is completed, you will find a .sh file waiting for you. Give it executable permission- Copy the file to your home directory. Then open a terminal and type:

sudo chmod a+x

Now, Simply double click it to install.

Alternately, you can run it from terminal. Copy the file to your home directory. Then open a terminal and type:

sudo sh

Of course, replace with the filename you just downloaded.

Now, store the large downloaded file to a safe location so that you may use it later, when you re-install Ubuntu!

How to make JAR from Java Source/Class files

You can make executable .JAR files from your java class files. This .jar file is a compressed single file which can be executed from desktop by opening double-clicking!

Fist of all, you need your class files of your program. So if you have three java sources, named, &, First of all go to command-prompt & make classes of the sources.

javac *.java

Assumed that you are running the command from the directory where your class files are located.

Next, we need to let the JAR know what’s the main class of the program. For this, create e text-file (i.e mainclass.txt) & write in the following manner:

Main-Class: they

IMPORTANT: the text file only needs the one line of text for this purpose. However,
the file must end with a blank line or this will not work, ie the file has two lines in it
– the second one is empty. Note too the class is called “they” and not “”
(the file containing the source code) or “they.class” (the file containing the byte
codes). If your class file is in a package hierarchy, you must use the fully qualified
name of the class (eg “myPackage.MyClass”).

Finally, run the jar utility with this command line:
jar cmf mainclass.txt example.jar *.class

That’s it!

Further reading:

Java’s Tutorial on Jar files:
Roedy Green’s JAR file page: