Make A Java Rubik's Cube


This page shows how to compile a very graphical java project such as the popular rubik's cube created by Karl Hörnell. Originally located here but now located here.

Java Rubik's Cube By Karl Hörnell, March 11, 1996.
Last modified April 17, 1996. Point the mouse at the cube and press s to scramble and r to reset.
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!

The HTML code shown below was used to display the rubik's cube seen above.

<applet code="rubik.class" archive="rubik.jar" width=120 height=120>
<param name=bgcolor value="744a44">
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET> tag!
</applet>


RUBIK'S CUBE SOURCE FILES

rubik.java code needed to build compressed binary jar file (15.8KB).
rubik.jar compressed java binary archive used by this web page (7.1KB).
rubik.sh script used here for automatic compiling (242 bytes).
rubik.tar.gz the original rubik's cube source code and example HTML file, however, please visit Karl's website for updates and other java program examples (10.4KB).


COMPILE JAVA MANUALLY

To compile "rubik.java" source code manually into a compressed "rubik.jar", follow these steps on the command line:
1.
2.

3.


4.



5.
 
[you@genesis ~]$ cd ~/temp
[you@genesis temp]$ javac -deprecation rubik.java
4 warnings
[you@genesis temp]$ jar cvf rubik.jar rubik.class
added manifest
adding: rubik.class(in = 13816) (out= 6812)(deflated 50%)               
[you@genesis temp]$ ls -l
-rw-r--r-- 1 you you 13816 2008-08-08 09:12 rubik.class
-rw-r--r-- 1 you you  7271 2008-08-08 09:12 rubik.jar
-rw-r--r-- 1 you you 16167 2008-08-08 12:11 rubik.java
[you@genesis temp]$ exit

  1. cd ~/temp - Change to the directory holding your "rubik.java" source code. This example assumes you placed the file in directory "~/temp".

  2. javac -deprecation rubik.java - Compile the 15.8KB java text file into a java class binary file.

  3. jar cvf rubik.jar rubik.class - Create a compressed jar file (7.1KB) from the class binary file (13.5KB).

  4. ls -l - This step is optional. List the resulting files.

  5. exit - You are done.


COMPILE JAVA BY SCRIPT

This "rubik.sh" script lets you compile the "rubik.java" code all in one step. This script assumes the project is in directory "~/temp"

#!/bin/sh
cd ~/temp

# Create compiled code from java file.
javac -deprecation rubik.java

# Create a compressed jar archive from compiled file.
jar cvf rubik.jar rubik.class

# Cleanup results
rm -f rubik.class

# Show results
ls -l rubik.*

Follow the steps below to compile this project.

1.






2.
 
[you@genesis ~]$ sh ~/temp/rubik.sh
4 warnings
added manifest
adding: rubik.class(in = 13816) (out= 6812)(deflated 50%)               
-rw-r--r-- 1 you you  7271 2008-08-08 09:12 rubik.jar
-rw-r--r-- 1 you you 16167 2008-08-08 12:11 rubik.java
-rwxr-xr-- 1 you you   242 2008-08-08 09:12 rubik.sh
[you@genesis ~]$ exit

  1. sh ~/temp/rubik.sh - Run the script to do all the steps needed to build this jar file. This project is assumed to be located in directory "~/temp".

  2. exit - You are done.


Other Java Pages On This Web Site
Java Install Example Clock Example Spreadsheet A Few Games

Other Pages On This Web Site
Home Page Backup With Tar Disk Image Backup BOINC On Linux android.rules For adb Server
Remove Duplicate Files Remove Spaces In File Names Change MAC Address Ship Arcade PicDis Disassembler



Copyright© 2000..2022 Joe's Cat

counter