Solution to ‘Unable to Create an Instance of the Java Virtual Machine’ for JDeveloper

6 08 2009

If you receive an error message like this when you’re opening JDeveloper, here’s the fix for it.

Error message: Unable to Create an Instance of the Java Virtual Machine Located at Path ..\..\jdk\jre\bin\client\jvm.dll

Solution 1: Copy jvm.dll file in jdk/jre/bin/client and paste to jdk/jre/bin/ojvm. Since ojvm folder has a file of the same name, make a backup of it first before you paste it so that you can revert back just in case it doesn’t work.

Solution 2: Go to Control Panel -> System -> Advanced -> Environment Variables and click ‘New’ on System variables.

Variable name: JRE_HOME

Variable value: C:\Program Files\Java\jre6





How to Fix “Resource is out of sync with the file system” in Eclipse

28 08 2008

This error occurs when you edit a workbench resource outside of Eclipse.
To fix this problem, right click the project or edited resource and select “Refresh”.
If you edit outside of Eclipse a lot, you can enable auto-refresh by going to Window->Preferences menu, then in the Preferences dialog box, select General->Workspace.
Check the “Refresh automatically” box.





Count Occurrence of Character in a String Using MySQL

15 04 2008

Since there is no inbuilt MySQL function to count the occurrence of a character in string, we can do it by using these steps:

1. Counting the number of characters in the original string

2. Temporarily ‘deleting’ the character you want to count and count the string again

3. Subtract the first count from the second to get the number of occurrences

Example:

SELECT LENGTH('foobarfoobarfoobar') - LENGTH(REPLACE('foobarfoobarfoobar', 'b', '')) AS `occurrences`
--> Result: 3

In this example ‘b’ is the string you want to count the number of occurrences.