ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-windows
php-windows
[PHP-WIN] Java and PHP
by Opere, James other posts by this author
Aug 1 2002 12:16PM messages near this date
[PHP-WIN] Re: php/javascript | RE: FW: [PHP-WIN] Does the GD extension work with windows?
------_=_NextPart_001_01C23955.4C95BC00
Content-Type: text/plain

I have installed Jdk 1.1.8, PHP version 4.2.2. I tried configuring Java to
work with PHP but I still get an error below when trying to run a scrip.

 

Fatal error: Unable to create Java Virtual Machine in c:\phpdev\www\java.php
on line 2

 

 The script is a sample script to test if php is working on well with java.

 

Does anyone have any idea as to why I  can't run the script below?

 

 

<?php

  $system = new java("java.lang.System");

  print "Java version=".$system-> getProperty("java.version")." <br>\n";

  print "Java vendor=".$system-> getProperty("java.vendor")." <p>\n\n";

  print "OS=".$system-> getProperty("os.name")." ".

              $system-> getProperty("os.version")." on ".

              $system-> getProperty("os.arch")." <br>\n";

 

  $formatter = new Java("java.text.SimpleDateFormat","EEEE, 

            MMMM dd, yyyy 'at' h:mm:ss a zzzz");

  print $formatter-> format(new Java("java.util.Date"))."\n";

  

?> 

 

I'm working on a windows XP.

 

J.Opere

 


------_=_NextPart_001_01C23955.4C95BC00
Content-Type: text/html

<html> 

<head> 
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII"> 


<meta name=Generator content="Microsoft Word 10 (filtered)"> 

<style> 
<!--
 /* Font Definitions */
 @font-face
	{font-family:"MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
	{font-family:"\@MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
span.EmailStyle17
	{font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
--> 
</style> 

</head> 

<body lang=EN-US link=blue vlink=purple> 

<div class=Section1> 

<p class=MsoNormal> <font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> I have installed Jdk 1.1.8, PHP version 4.2.2. I tried
configuring Java to work with PHP but I still get an error below when trying to
run a scrip.</span> </font></p>

<p class=MsoNormal> <font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> &nbsp;</span></font></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> Fatal error</span></font></b>: Unable
to create Java Virtual Machine in <b> <span style='font-weight:bold'>c:\phpdev\www\java.php</
span> </b>
on line <b> <span style='font-weight:bold'>2</span></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;</span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;The script is a sample script
to test if php is working on well with java.</span> </font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;</span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> Does anyone have any idea as to why I
&nbsp;can't run the script below?</span> </font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;</span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;</span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &lt;?php</span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp; $system = new java(&quot;java.lang.System&q
uot;);</span> </font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp; print &quot;Java
version=&quot;.$system-&gt;getProperty(&quot;java.version&quot;).&quot; &lt;br&gt;\n&quot;;<
/span> </font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp; print &quot;Java
vendor=&quot;.$system-&gt;getProperty(&quot;java.vendor&quot;).&quot;
&lt;p&gt;\n\n&quot;;</span> </font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp; print
&quot;OS=&quot;.$system-&gt;getProperty(&quot;os.name&quot;).&quot; &quot;.</span> </font></b
> </p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;
$system-&gt;getProperty(&quot;os.version&quot;).&quot; on &quot;.</span> </font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;
$system-&gt;getProperty(&quot;os.arch&quot;).&quot; &lt;br&gt;\n&quot;;</span> </font></b></p
> 

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;</span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp; $formatter = new Java(&quot;java.text.Simpl
eDateFormat&quot;,&quot;EEEE,
</span> </font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp; MMMM
dd, yyyy 'at' h:mm:ss a zzzz&quot;);</span> </font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp; print
$formatter-&gt;format(new Java(&quot;java.util.Date&quot;)).&quot;\n&quot;;</span> </font></b
> </p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp; </span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> ?&gt;</span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> &nbsp;</span></font></b></p>

<p class=MsoNormal> <b><font size=3 face="Times New Roman"><span
style='font-size:12.0pt;font-weight:bold'> I'm working on a windows XP.</span></font></b></p>

<p class=MsoNormal> <font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> &nbsp;</span></font></p>

<p class=MsoAutoSig> <font size=3 face="MS Mincho"><span style='font-size:12.0pt;
font-family:"MS Mincho"'> J.Opere</span></font></p>

<p class=MsoNormal> <font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> &nbsp;</span></font></p>

</div> 

</body> 

</html> 

------_=_NextPart_001_01C23955.4C95BC00--
Attachments:
unknown1


Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved