Bug: javac on OS X does not support -Xmx or -Xms switches

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,

javac -J-Xms256m -J-Xmx256m Hello.java
javac: invalid flag: -J-Xmx256m Usage: javac


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 08, 2005 at 05:32 PM 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 08, 2005 at 05:35 PM 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 04: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 03:26 PM PDT #

xzfdsfdsgfreyteyhthgdhbrtguyhurjtyjkthkhgjtyujtyjutyjyjyjyjyjyjyjyyt

Posted by langtuphudu189 on August 16, 2006 at 11:58 PM 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 01:23 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

moazam

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today