Reputation: 2271
I am trying to launch OSGI framework and to start few bundles on Android. One of these bundles is android API bundle which is an 18.5 MB jar. I read that in order to start the bundles on android, all the bundles should be first dexified.
So I tried to dexify this "android-4.1.1_r1.jar" using the following commands:
dx --dex --output=classes.dex C:\Users\student\Documents\eclipse\myPlugins\plugins\android-4.1.1_r1.jar
but I got this error on my command line:
java.lang.OutOfMemoryError: Java heap space
First: Do I really need to dexify this file? Second: if I have to dexify it, then how can I get rid of the above error?
to increase my heap size,
I tried: java -Xmx4g
, but I got
Invalid maximum heap size: -Xmx4g
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
then I tried java -Xmx2g
, but i got
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
so I tried java -Xmx1g
, and java -Xmx1100g
then I got:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for m
ore details.
In all cases, I still get the same error when I try to dexify the bundle file. What should I do? I am using Windows 32 bits with 4.00 GB installed (2.96 GB usable).
Upvotes: 0
Views: 367
Reputation: 718916
The maximum heap size is determined by a number of things, including:
On a modern 32bit windows (without PAE) the maximum you are likely to be able to request is likely to be 1.4Gb to 1.6Gb (reference). So -Xmx1g
should work ... unless you've got a lot of other things running at the same time.
So are you saying that what I showed above worked?
No.
I'm saying that it should have worked. The fact that you got a "usage" message is puzzling. I think it means there is something else wrong with the command line. (Did you forget to tell java
what class to run?)
A corollary from what I said is that it might work if you shut down various other applications (like your IDE, your web browser, your email client) to free up memory and/or paging file space. (A reboot might help too ... if your page file has gotten badly fragmented.)
If that doesn't help then:
Upvotes: 1