Why am i getting a ctrl-J on the end of this PHP generated line?
Im trying to generate a Java WebStart JNLP file from PHP. I'll put the whole code at the end, but my specific problem is this line of PHP:
<property name="jnlp.versionEnabled" value="true" />
<?php
echo "<property name=\"javaws.username\" value=\"" . $userid . "\" />"
?>
<property name="server.port" value="3000" />
The PHP generated line, I discovered after much struggling, is coming out with a ctrl-J on the end. This totally screws up Webstart. Why is it doing this and how do I stop it? The execution environment for the PHP is PHP5 on OpenSolaris.
The full code for this file is below for reference. (Dont pay any attention to the Windows section, I'm working on a Mac. I'll fix it once the mac section works correctly.)
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://fgdztgab.joyent.us/snowmen" href="snowman.php">
<information>
<title>Snowman</title>
<vendor>The RedDwarf Project</vendor>
&开发者_如何学运维lt;description kind="one-line">Game</description>
<description kind="short">Project Snowman Demo RedDwarf Game</description>
<description kind="tooltip">Project Snowman</description>
<shortcut online="false"><desktop/><menu submenu="Project Snowman"/></shortcut>
</information>
<security>
<all-permissions/>
</security>
<resources os="Mac" >
<j2se version="1.6+" initial-heap-size="32m" max-heap-size="1024m" />
<property name="jnlp.versionEnabled" value="true" />
<?php
echo "<property name=\"javaws.username\" value=\"" . $userid . "\" />"
?>
<property name="server.port" value="3000" />
<property name="server.host" value="fgdztgab.joyent.us" />
<nativelib href="projectsnowman/snowman-client-0.2-SNAPSHOT-macbinaries.jar"/>
<jar href="projectsnowman/snowman-client-jnlp-0.2-SNAPSHOT.jar"/>
<jar href="projectsnowman/snowman-client-0.2-SNAPSHOT.jar" main="true"/>
<jar href="projectsnowman/sgs-client-0.10.1.jar"/>
<jar href="projectsnowman/sgs-shared-1.12.jar"/>
<jar href="projectsnowman/mina-core-1.1.0.jar"/>
<jar href="projectsnowman/slf4j-api-1.4.0.jar"/>
<jar href="projectsnowman/slf4j-jdk14-1.4.0.jar"/>
<jar href="projectsnowman/snowman-common-0.2-SNAPSHOT.jar"/>
<jar href="projectsnowman/jme-2.0-S1.jar"/>
<jar href="projectsnowman/jme-terrain-2.0-S1.jar"/>
<jar href="projectsnowman/jme-audio-2.0-S1.jar"/>
<jar href="projectsnowman/jme-collada-2.0-S1.jar"/>
<jar href="projectsnowman/jme-effects-2.0-S1.jar"/>
<jar href="projectsnowman/jme-font-2.0-S1.jar"/>
<jar href="projectsnowman/jme-gamestates-2.0-S1.jar"/>
<jar href="projectsnowman/jme-model-2.0-S1.jar"/>
<jar href="projectsnowman/jme-scene-2.0-S1.jar"/>
<jar href="projectsnowman/jme-xml-2.0-S1.jar"/>
<jar href="projectsnowman/lwjgl-2.0rc2.jar"/>
<jar href="projectsnowman/lwjgl_util-2.0rc2.jar"/>
<jar href="projectsnowman/jorbis-0.0.17.jar"/>
<jar href="projectsnowman/fenggui-1.0-S1.jar"/>
<jar href="projectsnowman/environmentsystem-1.1.jar"/>
<jar href="projectsnowman/md5importer-1.2.4.jar"/>
<jar href="projectsnowman/snowman-client-0.2-SNAPSHOT-winbinaries.jar"/>
<jar href="projectsnowman/snowman-client-0.2-SNAPSHOT-macbinaries.jar"/>
</resources>
<resources os="Windows" >
<j2se version="1.6+" initial-heap-size="32m" max-heap-size="1024m" />
<property name="jnlp.versionEnabled" value="true"/>
<property name="client.username" value="<?php echo($_GET['userid']); ?>" />
<property name="server.port" value="3000" />
<property name="server.host" value="fgdztgab.joyent.us" />
<nativelib href="projectsnowman/snowman-client-0.2-SNAPSHOT-winbinaries.jar"/>
<jar href="projectsnowman/snowman-client-jnlp-0.2-SNAPSHOT.jar"/>
<jar href="projectsnowman/snowman-client-0.2-SNAPSHOT.jar" main="true"/>
<jar href="projectsnowman/sgs-client-0.10.1.jar"/>
<jar href="projectsnowman/sgs-shared-1.12.jar"/>
<jar href="projectsnowman/mina-core-1.1.0.jar"/>
<jar href="projectsnowman/slf4j-api-1.4.0.jar"/>
<jar href="projectsnowman/slf4j-jdk14-1.4.0.jar"/>
<jar href="projectsnowman/snowman-common-0.2-SNAPSHOT.jar"/>
<jar href="projectsnowman/jme-2.0-S1.jar"/>
<jar href="projectsnowman/jme-terrain-2.0-S1.jar"/>
<jar href="projectsnowman/jme-audio-2.0-S1.jar"/>
<jar href="projectsnowman/jme-collada-2.0-S1.jar"/>
<jar href="projectsnowman/jme-effects-2.0-S1.jar"/>
<jar href="projectsnowman/jme-font-2.0-S1.jar"/>
<jar href="projectsnowman/jme-gamestates-2.0-S1.jar"/>
<jar href="projectsnowman/jme-model-2.0-S1.jar"/>
<jar href="projectsnowman/jme-scene-2.0-S1.jar"/>
<jar href="projectsnowman/jme-xml-2.0-S1.jar"/>
<jar href="projectsnowman/lwjgl-2.0rc2.jar"/>
<jar href="projectsnowman/lwjgl_util-2.0rc2.jar"/>
<jar href="projectsnowman/jorbis-0.0.17.jar"/>
<jar href="projectsnowman/fenggui-1.0-S1.jar"/>
<jar href="projectsnowman/environmentsystem-1.1.jar"/>
<jar href="projectsnowman/md5importer-1.2.4.jar"/>
<jar href="projectsnowman/snowman-client-0.2-SNAPSHOT-winbinaries.jar"/>
<jar href="projectsnowman/snowman-client-0.2-SNAPSHOT-macbinaries.jar"/>
</resources>
<application-desc main-class="com.sun.darkstar.example.snowman.ClientApplication">
</application-desc>
</jnlp>
Set your editor to NOT generate or save .php files with a new line at the end.
Solved by going to heredoc format which moved the unwanted nl to the end of the file where it is annoying but harmless.
This might work:
<property name="jnlp.versionEnabled" value="true" />
<?php echo "<property name=\"javaws.username\" value=\"" . $userid . "\" />";?>
<property name="server.port" value="3000" />
Also, shouldn't there be a ;
on the end of that line?
精彩评论