b4a error create virtual machine

mike2ppc

Member
Licensed User
Longtime User
Hallo,

I've install java sdk 1.6_21 under Windows Vista and tried the hello world app to compile, but
I receiving

count not create the java virtual machine.

I also tried to change the program setting javac and java to comp. mode XP SP2 and admin authority.

Any idea what I've done wrong.

Thanks a lot

Michael
 

mike2ppc

Member
Licensed User
Longtime User
Can you post all of the compilation text message?

Compiling code. 0,078125
Generating R file. 1,015625
Compiling generated Java code. Error
Could not create the Java virtual machine.

Path setting in b4a
javac.exe = C:\Program Files\Java\jdk1.6.0_21\bin\javac.exe
android.jar = C:\Program Files\android-sdk-windows\platforms\android-8\android.jar
 
Upvote 0

mike2ppc

Member
Licensed User
Longtime User
Thanks. Is it possible that there is no free memory available?
I will send you by mail an updated version that may give more information.

Compiling code. 0,140625
Generating R file. 0,03125
Compiling generated Java code. Error
Invalid initial heap size: -Xms5000m
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.
 
Upvote 0

mike2ppc

Member
Licensed User
Longtime User
My apologies. I left this argument in the version I sent you (I added to try and reproduce the error message).
Can you please download the file from the same link again?

Compiling code. 0,046875
Generating R file. 0,015625
Compiling generated Java code. Error
Could not create the Java virtual machine.

Error occurred during initialization of VM
Could not reserve enough space for object heap
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This was helpful. Apparently you are out of memory. I've uploaded another file which sets the initial heap size to a lower value. You will be shown a msgbox asking if you want it set to 64mb (yes) or 32mb(no). Lets see if it will work.
Even if it work, it may fail in the next step.
Can you also check the amount of available RAM (under task manager)?
 
Upvote 0

mike2ppc

Member
Licensed User
Longtime User
This was helpful. Apparently you are out of memory. I've uploaded another file which sets the initial heap size to a lower value. You will be shown a msgbox asking if you want it set to 64mb (yes) or 32mb(no). Lets see if it will work.
Even if it work, it may fail in the next step.
Can you also check the amount of available RAM (under task manager)?

ok, now I received the msgbox asking 64 and I accepted with yes.
Now I receiving following message

Compiling code. 0,0615195
Generating R file. 0,001953
Compiling generated Java code. Error
Could not create the Java virtual machine.

Error occurred during initialization of VM
Could not reserve enough space for object heap

and when I accept msgbox with NO then I receive this message
Compiling code. 0,015624
Generating R file. 0,001953
Compiling generated Java code. Error
Could not create the Java virtual machine.

Error occurred during initialization of VM
Could not reserve enough space for object heap
 

Attachments

  • taskmanager.jpg
    taskmanager.jpg
    46.6 KB · Views: 509
  • taskmanager_resourcemanager.jpg
    taskmanager_resourcemanager.jpg
    61.5 KB · Views: 498
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
First thank you for your time.
Two more things that worth trying is:
- Open the ini file which is located under:
C:\Users\<Your user name>\AppData\Roaming\Anywhere Software\Basic4android
Change this line:
MaxRamForDex=1024

To a lower value:
MaxRamForDex=256

Note that you must do this change when Basic4android is closed. Otherwise it will override the change when it gets closed (and it reads it only when it opens).

- Second thing to try is to restart the computer and see if it works (don't even run the emulator).
 
Upvote 0

mike2ppc

Member
Licensed User
Longtime User
First thank you for your time.
Two more things that worth trying is:
- Open the ini file which is located under:
C:\Users\<Your user name>\AppData\Roaming\Anywhere Software\Basic4android
Change this line:
MaxRamForDex=1024

To a lower value:
MaxRamForDex=256

Note that you must do this change when Basic4android is closed. Otherwise it will override the change when it gets closed (and it reads it only when it opens).

- Second thing to try is to restart the computer and see if it works (don't even run the emulator).


Erel, now it works perfect. Thank you very much for your help.
When I get the next version or I do a reinstallation of b4a, do I have
to remember change the ini file ?
 
Upvote 0

mike2ppc

Member
Licensed User
Longtime User
Great.

You will probably won't need to do anything.
Can you please reinstall the formal version and see if it works? The one you are running included an additional change.

Erel, I've uninstalled b4a and have checked that the folder realy delete under program files.
After I have executed again the original setup.exe and now the compilation process works still correct. But I haven't deleted the user folder with the ini file.
 
Upvote 0

Eksatech

Member
Licensed User
Longtime User
Dear Erel,

I updated b4a to 5.8 but I am living same problem. I have changed MaxRamForDex=256 but still getting same message:

B4A version: 5.80
Parsing code. (0.04s)
Compiling code. (0.13s)
Compiling layouts code. (0.02s)
Generating R file. (0.04s)
Compiling debugger engine code. Error
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Error occurred during initialization of VM
Could not reserve enough space for object heap

What is your suggestions, what can I do?

Thanks from now.


Kamil Acar
 
Upvote 0
Top