Silly Question: Equivalent of C argv[0] in GCJ?

Ranjit Mathew rmathew@hotmail.com
Fri Oct 18 08:40:00 GMT 2002


Anthony Green wrote:
> On Thu, 2002-10-17 at 07:11, Ranjit Mathew wrote:
> 
>>     How does one get the name by which a program
>>was invoked (argv[0] in C) in a GCJ created
>>executable?
> 
> 
> There is no way right now, but that seems like a good idea.
> 
> 
>>I looked at the GCJ documentation and looked
>>at all the properties returned by System.getProperties( )
>>but nothing like this was there.
> 
> 
> I think a patch to set a system property like "gnu.gcj.progname" would
> be welcome.

"THY WISH IS MY COMMAND!"

------------------------------ 8< -----------------------------
--- natRuntime.cc.orig  Fri Oct 18 21:07:44 2002
+++ natRuntime.cc       Fri Oct 18 21:08:57 2002
@@ -534,4 +534,7 @@
      }

+  // The name used to invoke this process (argv[0] in C).
+  SET ( "gnu.gcj.progname", _Jv_ThisExecutable( ));
+
    // Allow platform specific settings and overrides.
    _Jv_platform_initProperties (newprops);
------------------------------ 8< -----------------------------

:-)

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/





More information about the Java mailing list