Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 10262 invoked from network); 11 Aug 2005 14:12:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Aug 2005 14:12:22 -0000 Received: (qmail 75327 invoked by uid 500); 11 Aug 2005 14:12:18 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 75285 invoked by uid 500); 11 Aug 2005 14:12:18 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 75260 invoked by uid 99); 11 Aug 2005 14:12:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2005 07:12:17 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [129.183.4.8] (HELO ecfrec.frec.bull.fr) (129.183.4.8) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2005 07:12:38 -0700 Received: from localhost (localhost [127.0.0.1]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id B3BCE19DF20 for ; Thu, 11 Aug 2005 16:12:09 +0200 (CEST) Received: from ecfrec.frec.bull.fr ([127.0.0.1]) by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22700-05 for ; Thu, 11 Aug 2005 16:12:08 +0200 (CEST) Received: from ecn002.frec.bull.fr (ecn002.frec.bull.fr [129.183.4.6]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id B0CB819DEFF for ; Thu, 11 Aug 2005 16:12:07 +0200 (CEST) Received: from [129.183.101.62] ([129.183.101.62]) by ecn002.frec.bull.fr (Lotus Domino Release 5.0.12) with ESMTP id 2005081116243596:2085 ; Thu, 11 Aug 2005 16:24:35 +0200 Message-ID: <42FB5CBD.2020700@objectweb.org> Date: Thu, 11 Aug 2005 16:12:13 +0200 From: Guillaume Sauthier Organization: ObjectWeb Consortium User-Agent: Debian Thunderbird 1.0 (X11/20050116) X-Accept-Language: en-us, en MIME-Version: 1.0 To: axis-dev@ws.apache.org Subject: [Axis2] problem with using the Ant Javac programmatically References: <20050811071118.6709D10FB2A9@asf.osuosl.org> In-Reply-To: X-MIMETrack: Itemize by SMTP Server on ECN002/FR/BULL(Release 5.0.12 |February 13, 2003) at 11/08/2005 16:24:35, Serialize by Router on ECN002/FR/BULL(Release 5.0.12 |February 13, 2003) at 11/08/2005 16:24:37, Serialize complete at 11/08/2005 16:24:37 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Virus-Scanned: by amavisd-new at frec.bull.fr X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N instead of running cmd.exe, run javac directly ? Guillaume Venkat Reddy wrote: >I know. If the basic idea really works for you atleast on windows, it >gives the hint and you can always find an equivalent command for other >platforms :-) > >- venkat > >On 8/11/05, Eran Chinthaka wrote: > > >>Small problem. IMHO, this will work only in windows. You have used cmd.exe. >> >> >> >>>Ajith, >>> >>>I used the following code to get the value of environment variable >>>"JAVA_HOME" instead of sysetm variable "java.home" which always points >>>to jre. >>> >>> public static String getEnv(String env) throws Exception { // >>>env="JAVA_HOME" >>> Properties envVars = new Properties(); >>> Runtime r = Runtime.getRuntime(); >>> Process p = r.exec( "cmd.exe /c set" ); >>> BufferedReader br = new BufferedReader ( new >>>InputStreamReader( p.getInputStream() ) ); >>> >>> for (String line; (line = br.readLine()) != null; ) { >>> int idx = line.indexOf( '=' ); >>> String key = line.substring( 0, idx ); >>> if (key.equals(env)) >>> return line.substring( idx+1 ); >>> } >>> return ""; >>> } >>> >>>- venkat >>> >>> >>>On 8/9/05, Guillaume Sauthier wrote: >>> >>> >>>>Hi Ajith >>>> >>>>java.home sysprop is always pointing to the JRE directory. >>>>In JOnAS, when we launch the javac command, we have to use this little >>>>code snippet to get a real java.home (a JDK home) >>>> >>>> javaHomeBin = System.getProperty("java.home", ""); >>>> if (!("".equals(javaHomeBin))) { >>>> if (Env.isOsMacOsX()) { >>>> javaHomeBin = javaHomeBin + File.separator + "bin" + >>>>File.separator; >>>> } else { >>>> javaHomeBin = javaHomeBin + File.separator + ".." + >>>>File.separator + "bin" + File.separator; >>>> } >>>> } >>>> >>>>Maybe you can use this and reassign the java.home sysprop ? >>>> >>>>Bye >>>>Guillaume >>>> >>>>Ajith Ranabahu wrote: >>>> >>>> >>>> >>>>>Hi all, >>>>>I am writing an end to end test case for the code generator. To >>>>>compile the generated code I use the Javac task from Ant. However I >>>>>'ve come across some problems, specially a weird problem where the >>>>>'java.home' appears to be pointing to the Java runtime instead of the >>>>>JDK home. >>>>>Here are the details of the problem >>>>>I've used the Javac class (from Ant) to run the compiler. When I run >>>>>the compiler I get an error message saying "Unable to find compiler, >>>>>Perhaps the JAVA_HOME is pointing to the correct place". I've gone >>>>>through the Javac code and then figured out that the compiler is >>>>>searched using the 'java.home' directory. Strangely I have my >>>>>JAVA_HOME pointed to c:\java\jdk1.4 but the 'java.home' system >>>>>property points to the c:\java\jdk1.4\jre directory (where there is no >>>>>reference to the tools.jar) and the compile task fails miserably :(. I >>>>>did some tests and figured that the value of the java.home system >>>>>property changes according to the environment you run java ! >>>>>Currently the compile code is commented. >>>>>Any pointer is appreciated >>>>> >>>>>Thanks >>>>>-- >>>>>Ajith Ranabahu >>>>> >>>>> >>>> >>>> >>>> >> >> >> >> > > >