This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: -classpath option for gij


I'm checking this in.

Today I needed gij to recognize the `-cp' argument.  The Sun and IBM
`java' commands support this, and I wanted to use gij in a context
where one of these programs is ordinarily used.

The appended patch has two parts, one the implementation and the
second part the documentation.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* gij.cc (help): Document -cp and -classpath.
	(main): Handle -classpath.

Index: gij.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gij.cc,v
retrieving revision 1.18
diff -u -r1.18 gij.cc
--- gij.cc 27 Feb 2002 05:32:13 -0000 1.18
+++ gij.cc 22 Aug 2002 22:39:18 -0000
@@ -28,11 +28,14 @@
   printf ("          to interpret Java bytecodes, or\n");
   printf ("       gij -jar [OPTION] ... JARFILE [ARGS] ...\n");
   printf ("          to execute a jar file\n\n");
+  printf ("  --cp LIST         set class path\n");
+  printf ("  --classpath LIST  set class path\n");
   printf ("  -DVAR=VAL         define property VAR with value VAL\n");
   printf ("  --help            print this help, then exit\n");
   printf ("  --ms=NUMBER       set initial heap size\n");
   printf ("  --mx=NUMBER       set maximum heap size\n");
   printf ("  --version         print version number, then exit\n");
+  printf ("\nOptions can be specified with `-' or `--'.\n");
   printf ("\nSee http://gcc.gnu.org/java/ for information on reporting bugs\n");
   exit (0);
 }
@@ -114,6 +117,15 @@
 	  if (i >= argc - 1)
 	    goto no_arg;
 	  _Jv_SetMaximumHeapSize (argv[++i]);
+	}
+      else if (! strcmp (arg, "-cp") || ! strcmp (arg, "-classpath"))
+	{
+	  if (i >= argc - 1)
+	    goto no_arg;
+	  // We set _Jv_Jar_Class_Path.  If the user specified `-jar'
+	  // then the jar code will override this.  This is the
+	  // correct behavior.
+	  _Jv_Jar_Class_Path = argv[++i];
 	}
       else
 	{
Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* gcj.texi (Invoking gij): Document -cp and -classpath.

Index: gcj.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/gcj.texi,v
retrieving revision 1.34
diff -u -r1.34 gcj.texi
--- gcj.texi 16 Aug 2002 21:49:33 -0000 1.34
+++ gcj.texi 22 Aug 2002 22:39:55 -0000
@@ -730,6 +730,7 @@
 gij [@option{OPTION}] @dots{} @var{JARFILE} [@var{ARGS}@dots{}]
 
 gij [@option{-jar}] [@option{OPTION}] @dots{} @var{CLASS} [@var{ARGS}@dots{}]
+  [@option{-cp} @var{path}] [@option{-classpath} @var{path}]
   [@option{-D}@var{name}[=@var{value}]@dots{}]
   [@option{-ms=}@var{number}] [@option{-mx=}@var{number}]
   [@option{--version}] [@option{--help}]
@@ -772,6 +773,13 @@
 @c man begin OPTIONS gij
 
 @table @gcctabopt
+@item -cp @var{path}
+@itemx -classpath @var{path}
+Set the initial class path.  The class path is used for finding
+class and resource files.  If specified, this option overrides the
+@code{CLASSPATH} environment variable.  Note that this option is
+ignored if @code{-jar} is used.
+
 @item -D@var{name}[=@var{value}]
 This defines a system property named @var{name} with value @var{value}.
 If @var{value} is not specified then it defaults to the empty string.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]