shell_exec fails to compile java class?
shell_exec fails to compile java class?
am 01.11.2009 22:50:43 von daniel danon
--001636b2b038ba7bf8047756400a
Content-Type: text/plain; charset=UTF-8
Hello!
I need to use shell_exec (or any other similar function) in order to compile
a java class-file.
I have all the needed components installed on my computer (Windows XP with
Java SDK) - I can use "java c:\path...." in order to compile using
Start->Run.
When I try to do the same with shell_exec or `` it returns null and it
doesn't compiles. Even when there are errors - it doesn't show them at all.
I've tried to use instead of "java c:\path..." the full java command line
compiler path but it didn't work either.
When I try functions such as "echo test" it works.
Clearly I'm missing here something - problem is... what?
--
Use ROT26 for best security
--001636b2b038ba7bf8047756400a--
Re: shell_exec fails to compile java class?
am 04.11.2009 15:34:52 von Nathan Rixham
×× ××× ×× ×× wrote:
> Hello!
>
> I need to use shell_exec (or any other similar function) in order to compile
> a java class-file.
>
> I have all the needed components installed on my computer (Windows XP with
> Java SDK) - I can use "java c:\path...." in order to compile using
> Start->Run.
>
> When I try to do the same with shell_exec or `` it returns null and it
> doesn't compiles. Even when there are errors - it doesn't show them at all.
>
> I've tried to use instead of "java c:\path..." the full java command line
> compiler path but it didn't work either.
>
>
> When I try functions such as "echo test" it works.
>
>
> Clearly I'm missing here something - problem is... what?
>
create an ant builder or .bat and call that instead; most likely because
the environment isn't set up correctly when executing via php; thus when
using ant or bat you can set everything up correctly as needed.
always use PHP on linux but permissions and the scope / permissions of
the account php runs under may come in to play?
nathan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: shell_exec fails to compile java class?
am 06.11.2009 19:04:50 von daniel danon
--0016e6d3de5822bd6c0477b7ae39
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hello, Thank you - I've managed to do that using a bat file like you
suggested.
Only problem is that:
When I try to call:
C:\\Java\bin\javac.exe Tester.java > test.txt
(Which should run Tester.java and log any results into test.txt),
When there are compilation errors and this command returns results -
test.txt stays empty.
Any suggestions?
On Wed, Nov 4, 2009 at 4:34 PM, Nathan Rixham wrote:
> ×× ××× ×× ×× wrote:
>
>> Hello!
>>
>> I need to use shell_exec (or any other similar function) in order to
>> compile
>> a java class-file.
>>
>> I have all the needed components installed on my computer (Windows XP wi=
th
>> Java SDK) - I can use "java c:\path...." in order to compile using
>> Start->Run.
>>
>> When I try to do the same with shell_exec or `` it returns null and it
>> doesn't compiles. Even when there are errors - it doesn't show them at
>> all.
>>
>> I've tried to use instead of "java c:\path..." the full java command lin=
e
>> compiler path but it didn't work either.
>>
>>
>> When I try functions such as "echo test" it works.
>>
>>
>> Clearly I'm missing here something - problem is... what?
>>
>>
> create an ant builder or .bat and call that instead; most likely because
> the environment isn't set up correctly when executing via php; thus when
> using ant or bat you can set everything up correctly as needed.
>
> always use PHP on linux but permissions and the scope / permissions of th=
e
> account php runs under may come in to play?
>
> nathan
>
--=20
Use ROT26 for best security
--0016e6d3de5822bd6c0477b7ae39--
Re: Re: shell_exec fails to compile java class?
am 06.11.2009 20:11:35 von John Hicks
????? ???? wrote:
> Hello, Thank you - I've managed to do that using a bat file like you
> suggested.
>
> Only problem is that:
>
> When I try to call:
> C:\\Java\bin\javac.exe Tester.java > test.txt
> (Which should run Tester.java and log any results into test.txt),
>
> When there are compilation errors and this command returns results -
> test.txt stays empty.
>
> Any suggestions?
>
Where are you trying to write text.txt? Are you setting a current
working directory in your batch file? Do you have write permission in
this directory?
john
> On Wed, Nov 4, 2009 at 4:34 PM, Nathan Rixham wrote:
>
>
>> ????? ???? wrote:
>>
>>
>>> Hello!
>>>
>>> I need to use shell_exec (or any other similar function) in order to
>>> compile
>>> a java class-file.
>>>
>>> I have all the needed components installed on my computer (Windows XP with
>>> Java SDK) - I can use "java c:\path...." in order to compile using
>>> Start->Run.
>>>
>>> When I try to do the same with shell_exec or `` it returns null and it
>>> doesn't compiles. Even when there are errors - it doesn't show them at
>>> all.
>>>
>>> I've tried to use instead of "java c:\path..." the full java command line
>>> compiler path but it didn't work either.
>>>
>>>
>>> When I try functions such as "echo test" it works.
>>>
>>>
>>> Clearly I'm missing here something - problem is... what?
>>>
>>>
>>>
>> create an ant builder or .bat and call that instead; most likely because
>> the environment isn't set up correctly when executing via php; thus when
>> using ant or bat you can set everything up correctly as needed.
>>
>> always use PHP on linux but permissions and the scope / permissions of the
>> account php runs under may come in to play?
>>
>> nathan
>>
>>
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: shell_exec fails to compile java class?
am 06.11.2009 20:36:51 von daniel danon
--00163698966c2b05af0477b8f708
Content-Type: text/plain; charset=UTF-8
Where are you trying to write text.txt? Are you setting a current working
directory in your batch file? Do you have write permission in this
directory?
(copied it to make it easier to understand my answer)
In the same folder.
Yes, there is a "cd javafiles"
Yes.
I know its not a permission / directory sort of things, since when there are
no errors - the .class compiled java files are created properly.
On Fri, Nov 6, 2009 at 9:11 PM, John List wrote:
> ????? ???? wrote:
>
>> Hello, Thank you - I've managed to do that using a bat file like you
>> suggested.
>>
>> Only problem is that:
>>
>> When I try to call:
>> C:\\Java\bin\javac.exe Tester.java > test.txt
>> (Which should run Tester.java and log any results into test.txt),
>>
>> When there are compilation errors and this command returns results -
>> test.txt stays empty.
>>
>> Any suggestions?
>>
>>
>
> Where are you trying to write text.txt? Are you setting a current working
> directory in your batch file? Do you have write permission in this
> directory?
>
> john
>
> On Wed, Nov 4, 2009 at 4:34 PM, Nathan Rixham wrote:
>>
>>
>>
>>> ????? ???? wrote:
>>>
>>>
>>>
>>>> Hello!
>>>>
>>>> I need to use shell_exec (or any other similar function) in order to
>>>> compile
>>>> a java class-file.
>>>>
>>>> I have all the needed components installed on my computer (Windows XP
>>>> with
>>>> Java SDK) - I can use "java c:\path...." in order to compile using
>>>> Start->Run.
>>>>
>>>> When I try to do the same with shell_exec or `` it returns null and it
>>>> doesn't compiles. Even when there are errors - it doesn't show them at
>>>> all.
>>>>
>>>> I've tried to use instead of "java c:\path..." the full java command
>>>> line
>>>> compiler path but it didn't work either.
>>>>
>>>>
>>>> When I try functions such as "echo test" it works.
>>>>
>>>>
>>>> Clearly I'm missing here something - problem is... what?
>>>>
>>>>
>>>>
>>>>
>>> create an ant builder or .bat and call that instead; most likely because
>>> the environment isn't set up correctly when executing via php; thus when
>>> using ant or bat you can set everything up correctly as needed.
>>>
>>> always use PHP on linux but permissions and the scope / permissions of
>>> the
>>> account php runs under may come in to play?
>>>
>>> nathan
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>
--
Use ROT26 for best security
--00163698966c2b05af0477b8f708--
Re: Re: shell_exec fails to compile java class?
am 13.11.2009 08:25:58 von Mark Cilissen
×× ××× ×× ×× schreef:
> Where are you trying to write text.txt? Are you setting a current working
> directory in your batch file? Do you have write permission in this
> directory?
> (copied it to make it easier to understand my answer)
> In the same folder.
> Yes, there is a "cd javafiles"
> Yes.
>
> I know its not a permission / directory sort of things, since when there are
> no errors - the .class compiled java files are created properly.
>
> On Fri, Nov 6, 2009 at 9:11 PM, John List wrote:
>
>> ????? ???? wrote:
>>
>>> Hello, Thank you - I've managed to do that using a bat file like you
>>> suggested.
>>>
>>> Only problem is that:
>>>
>>> When I try to call:
>>> C:\\Java\bin\javac.exe Tester.java > test.txt
>>> (Which should run Tester.java and log any results into test.txt),
>>>
>>> When there are compilation errors and this command returns results -
>>> test.txt stays empty.
>>>
>>> Any suggestions?
>>>
>>>
>> Where are you trying to write text.txt? Are you setting a current working
>> directory in your batch file? Do you have write permission in this
>> directory?
>>
>> john
>>
>> On Wed, Nov 4, 2009 at 4:34 PM, Nathan Rixham wrote:
>>>
>>>
>>>> ????? ???? wrote:
>>>>
>>>>
>>>>
>>>>> Hello!
>>>>>
>>>>> I need to use shell_exec (or any other similar function) in order to
>>>>> compile
>>>>> a java class-file.
>>>>>
>>>>> I have all the needed components installed on my computer (Windows XP
>>>>> with
>>>>> Java SDK) - I can use "java c:\path...." in order to compile using
>>>>> Start->Run.
>>>>>
>>>>> When I try to do the same with shell_exec or `` it returns null and it
>>>>> doesn't compiles. Even when there are errors - it doesn't show them at
>>>>> all.
>>>>>
>>>>> I've tried to use instead of "java c:\path..." the full java command
>>>>> line
>>>>> compiler path but it didn't work either.
>>>>>
>>>>>
>>>>> When I try functions such as "echo test" it works.
>>>>>
>>>>>
>>>>> Clearly I'm missing here something - problem is... what?
>>>>>
>>>>>
>>>>>
>>>>>
>>>> create an ant builder or .bat and call that instead; most likely because
>>>> the environment isn't set up correctly when executing via php; thus when
>>>> using ant or bat you can set everything up correctly as needed.
>>>>
>>>> always use PHP on linux but permissions and the scope / permissions of
>>>> the
>>>> account php runs under may come in to play?
>>>>
>>>> nathan
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>
>
Hello,
You should execute:
C:\\Java\bin\javac.exe Tester.java 1>test.txt 2>&1
This will redirect normal messages as well as errors to your text file.
--
Kind regards,
Mark Cilissen / Pixlism
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php