The javac command on OS X does not support the -Xmx or -Xms switches for changing default memory sizes. For example, the following works on Solaris & Windows, but fails on OS X Tiger,
Other switches, such as -J-Xloggc:file.out work fine on OS X.
I've tried passing the switch as '-Xms256m' also, but that also fails. This is a pretty significant bug because without being able to pass -Xms/Xmx values to javac, certain large software builds will fail with an OutOfMemory error.
This is on OS X 10.4.2, with Java 5.
ae86:~ moazam$ java -version
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-56)
Java HotSpot(TM) Client VM (build 1.5.0_02-36, mixed mode, sharing)
I've filed a bug with Apple, let's see what happens.
Comments:
Does <code>javac -J-Xmx256m Hello.java</code> work (i.e. use <code>-J</code> only once)?
What does <code>java -help</code> say?
Also, do you need to pass both parameters?
Posted by
Alexis MP
on October 09, 2005 at 12:32 AM PDT
#
Yuhp, javac -J-Xmx256m works perfectly on Solaris. I know, I didn't think it would, but it does, and it is included in the -help options (well, the -J description is). Works in Solaris, not in OS X.
Posted by
Moazam
on October 09, 2005 at 12:35 AM PDT
#
helm:/tmp sam$ cat > Hello.java
public class Hello {}
helm:/tmp sam$ javac -J-Xms256m -J-Xmx256m Hello.java
helm:/tmp sam$ ls -l Hello.class
-rw-r--r-- 1 sam wheel 184 Oct 10 11:49 Hello.class
helm:/tmp sam$ java -version
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-59)
Java HotSpot(TM) Client VM (build 1.5.0_04-39, mixed mode, sharing)
helm:/tmp sam$ uname -a
Darwin helm.gsc.com 8.2.0 Darwin Kernel Version 8.2.0: Fri Jun 24 17:46:54 PDT 2005; root:xnu-792.2.4.obj~3/RELEASE_PPC Power Macintosh powerpc
Posted by
Sam Pullara
on October 10, 2005 at 11:51 AM PDT
#
Nice! I just downloaded a newer Apple Java release and the bug is fixed.
ae86:~/code moazam$ java -version
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-61)
Java HotSpot(TM) Client VM (build 1.5.0_05-40, mixed mode, sharing)
Thanks for pointing that out Sam.
Posted by
Moazam
on October 10, 2005 at 10:26 PM PDT
#
Posted by
langtuphudu189
on August 17, 2006 at 06:58 AM PDT
#
class Hello {
public static void main(String [] args) {
System.out.println("Hello Java");
}
}
err:javac:Invalid flag:Hello
Pls answer me why alert that top.
sometime i run on dos have err"Exeption in tread "main" java.lang.NoClassDefFoundError:HelloWorld"
Posted by
momo
on September 06, 2006 at 08:23 PM PDT
#
What does <code>java -help</code> say?
Also, do you need to pass both parameters?
Posted by Alexis MP on October 09, 2005 at 12:32 AM PDT #
Posted by Moazam on October 09, 2005 at 12:35 AM PDT #
helm:/tmp sam$ cat > Hello.java public class Hello {} helm:/tmp sam$ javac -J-Xms256m -J-Xmx256m Hello.java helm:/tmp sam$ ls -l Hello.class -rw-r--r-- 1 sam wheel 184 Oct 10 11:49 Hello.class helm:/tmp sam$ java -version java version "1.5.0_04" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-59) Java HotSpot(TM) Client VM (build 1.5.0_04-39, mixed mode, sharing) helm:/tmp sam$ uname -a Darwin helm.gsc.com 8.2.0 Darwin Kernel Version 8.2.0: Fri Jun 24 17:46:54 PDT 2005; root:xnu-792.2.4.obj~3/RELEASE_PPC Power Macintosh powerpcPosted by Sam Pullara on October 10, 2005 at 11:51 AM PDT #
Posted by Moazam on October 10, 2005 at 10:26 PM PDT #
Posted by langtuphudu189 on August 17, 2006 at 06:58 AM PDT #
Posted by momo on September 06, 2006 at 08:23 PM PDT #