Wednesday, May 9, 2012

Java Applet - Clear Java cache

Recently I started to write Java Applet by following the tutorial on Oracle website (http://docs.oracle.com/javase/tutorial/deployment/applet/index.html). One of the features I will need is to invoke Applet methods from JavaScript. The sample code in this subject, Invoking JavaScript Code From an Applet, works fine. But I just could not get my code work after I changed everything (parameter values, function name, and etc...) accordingly in the sample code. The weird thing was it kept using the Applet from the sample code, and never used the one I just created. After doing hours of research on the Internet, I found that Java also has the cache mechanism to improve performance just like the web browser. So after I cleared the Java cache, everything worked as expected. Here is the how-to of clearing Java cache.

Go to Control Panel

You may need to switch to Classic View if you are in Category View

Double click on Java icon and you will see Java Control Panel pops up, then click on Settings...

Click Delete Files...

I deleted all of them


Note, the sample code I downloaded for Invoking Applet Methods From JavaScript Code tutorial is missing the file applet_InvokingAppletMethodsFromJavaScript.jar (as of now). To obtain the jar, go to http://docs.oracle.com/javase/tutorial/deployment/applet/examples/dist/applet_InvokingAppletMethodsFromJavaScript/applet_InvokingAppletMethodsFromJavaScript.jar if you don't feel like compiling the source files for now.

Friday, May 4, 2012

Amazon Kindle Fire - delete app permanently

Just received my Kindle Fire today. It's quite convenient that it automatically backs up the apps you downloaded to the cloud if you have account set up. But it's also quite annoying that the app icon retains on the device even if you have already deleted it. To completely delete the app, you will need to delete it from the device and the cloud.

On the device, press on the app for a couple seconds, then the option with delete will pop up. Then simply tap on delete to remove it from local.

On the cloud side, go to "Your Account" on Amazon, scroll down to the bottom and find the "Digital Content" section. Go to "Your Apps and Devices" to manage the apps on cloud. For the apps you want to remove, clicks on "Actions..." for the options.

Once the app is remove on both places, deregister the Kindle Fire. After you register back, you won't see those unwanted icons.

But the those pre-loaded app, you cannot really remove them.

Saturday, January 14, 2012

Hollywood sign

To see the best view of Hollywood sign, follow to this address with your GPS

3204 Canyon Lake Drive
Hollywood, CA 90068

I am not sure if this is the address of this place, but you will see it when getting close to the address.



Wednesday, November 23, 2011

Understand Hello World example

A Java class is like the design you draw on a blueprint, you want to define details, functionality for an object before you actually create and use it.

The Hello World example does not have much going on yet, but it consists of the most fundamental lines. Here is the line-by-line explanation.
1. public class HelloWorld - declare a class and name it HelloWorld
2. public static void main(String[] args) - the start point of the program. In some programming languages, usually it's the "main" to start the whole process.
3. System.out.println("Hello World") - this is the line that actually does the job to print out "Hello World" on the screen". You can play it around little bit by changing "Hello World" to something else like "Hello Galaxy", re-compile the code (command javac HelloWorld.java), and run it again (command java HelloWorld). You will see "Hello Galaxy" on the screen.

Tuesday, November 22, 2011

The first Java program - Hello World

Once you have the Java program properly installed, you are ready to try out the "Hello World". Open an text editor and enter the following,

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

and save it as HelloWorld.java. Be sure the extension name is java.

Then open the command prompt and move to the directory where HelloWorld.java is saved. To compile the java program, run the command "javac HelloWorld.java". You should get another file named HelloWorld.class if the program has be successfully compiled. Then issue the command "java HelloWorld" and you will see "Hello World" printed out on the screen.











Saturday, May 14, 2011

Start your Java - installation

To run a Java program, you will need to have Java Vuirtual Machine (JVM) installed on your machine. It can be downloaded from Oracle website, http://www.oracle.com/technetwork/java/javase/downloads/index.html

Upon opening the link, you will see a couple download sections. For the most basic setup, the "Java Platform, Standard Edition" is the one you are looking for. There are two download options here, JDK and JRE. If you are just going to run Java programs on your machine, JRE (Java Runtime Environment) is the one. If you will be doing Java development, you will need to get JDK which includes Java compiler to compile your code and JRE. So if you have already download JDK, you don't need another JRE.

Once installation is completed, the executables are ready to run. On Windows, they can be found in C:\Program Files\Java\jdk1.x.x_xx\bin by default. But for your convenience, it's better to add the path to the environmental variable PATH (having Java available to environment is required if you are going to use some development tool like Eclipse).

To verify the installation, open the command prompt and type "java -version" or "javac -version" (if JDK was installed). You should see the software version number returned by the program.