Talk to JavaScript with Java

Communication between JavaScript and Java applets can be made possible using something called LiveConnect. JavaScript can be used to access Java variables, classes and methods directly, and conversely Java can be used to access JavaScript methods and properties. Enabling LiveConnect Before Java and JavaScript can communicate at all, LiveConnect must be enabled. This is done by putting a special...

Posted in JavaScript Java at 2005-10-23T05:41:38Z.

Native Methods with the Java Native Interface

The Java Native Interface (JNI) allows you to integrate native code with Java programs. Native methods are methods implemented in another programming language (such as C or assembly language). Reasons for using the JNI: Platform-specific features can be accessed that aren't available through the Java Virtual Machine (JVM). Existing libraries and applications written in other programming langua...

Posted in Java at 2005-10-23T05:44:50Z.

Using JDBC in Java Programs

JDBC allows you to access any data source for which you have an appropriate driver. The relevant packages are java.sql and the more recent javax.sql. In your Java code, first you need to load the driver. This can be done like this: try { Class.forName("org.gjt.mm.mysql.jdbc").newInstance(); } catch(InstantiationException e) { e.printStackTrace(); } That will load the driver. Next you need...

Posted in Java at 2005-11-08T02:59:04Z.

The Java Virtual Machine

The Java Virtual Machine or Java interpreter is an essential piece of every Java installation, without this you cannot run any Java programs! Java programs are portable, but they rely on this interpreter and so will only run on platforms which have the interpreter installed. Sun has VM implementations for Windows 95/98 as well as its own Solaris operating system. Many other vendors such as Apple, ...

Posted in Java at 2005-11-08T03:34:34Z.

Java Optimization

Optimizing Compared to natively compiled programs in other languages, Java programs generally have reduced performance. However, optimization techniques can be employed to increase your program's performance greatly in some cases. First of all I would like to point out that you shouldn't optimize your code unless you really need to. A lot of time can be spent optimizing, but with little gain in ...

Posted in Java at 2005-11-08T03:39:02Z.