Tips and Tricks in a world of Mix

Posts tagged ‘java’

Call java object from javascript

More and more I see entire products built on this ability which is pretty simple really .

How can we connect a responsive and dynamic UI such as Html5 that is able to migrate easily between devices with the Java ability of controlling the device under Android OS ? 

The idea is to :

  1. Set the promise and enabling usage of javascript interface in Java
  2. Create the corresponding implementation for the javascript interface in Java 
  3. Call the Java class and functionality from javascript – letting you control the device with the whole power of Java drivers from html5 – JQuery UI .

How to recipe :

  • in :   

private DefMemoryReleaser  dmr ;


   dmr = new DefMemoryReleaser(this, appView);

   appView.addJavascriptInterface(dmr, “JavaDefMemoryReleaser”);


  •  buildjava corresponding class DefMemoryReleaser

package com.EggedDefinition;

import org.apache.cordova.DroidGap;

import android.webkit.WebView;

public class DefMemoryReleaser {

         private WebView mAppView;

         private DroidGap mGap;

          public DefMemoryReleaser(DroidGap gap, WebView view)


           mAppView = view;

           mGap = gap;


         public void freeMemory(){







  • in javascript : 

if (typeof (window.JavaDefMemoryReleaser) != ‘undefined’)



Now you are ready and set to build and sell security products for Android – Godspeed !  🙂


Working with Eclipse windows 7 64 bit problem


So in my efforts to start working with mobile devices one of the esseseties is Eclipse .

I’m new to this .

I’ve downloaded the biggest eclipse available from here .

For full list go to this link


So I’ve downloaded and extracted the zip . Pressed the eclipse.exe and..


A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
javaw.exe in your current PATH

What’s that all about ..

Started digging around and found this post at the stackoverflow .

I’ve done it all -  all the anoying suggestions about altering your path and building java home , and letting the decide for you what to install ..

Got dispeared and went home .

At last went on the suggestion about downloading different java for 64 bit at this link


Apperantly if you use IE that installed as x86 then it will install 32 bit java version that won’t work with 64 bit Eclipse .

Tag Cloud

%d bloggers like this: