PDA

View Full Version : lzc command-line compiler


deng
05-25-2006, 09:06 AM
Has anyone tried the lzc command-line compiler? It didn't work for me.

I am using Windows XP and downloaded Open Laszlo 3.3 for windows. The lzc compiler is in 2 locations:

C:\Program Files\OpenLaszlo Server 3.3\Server\lps-3.3\WEB-INF\lps\server\bin

and

C:\Program Files\OpenLaszlo Server 3.3\bin

I checked the files and they look more or less the same.

Also under each location, there is a "lzc" file written in bash script and a "lzc.bat" file written in DOS batch script. I assume the first one is for using with cygwin. However, neither "lzc" nor "lzc.bat" worked. I kept on getting errors like:

The system cannot find the file specified.

Has anyone had any good luck with the lzc compiler on Windows platform? Really appreciate any help. Otherwise, I would have to read the script files myself and fix them.

thanks,
Yining

paou
05-26-2006, 12:03 AM
Hi,

I'm running 3.2cr2, but I had the lzc compiler working under windows... I had to modify the batch file, which was a right pain... Basically, the environment variables were wrong / missing... Instead of trying to figure out why, I just pasted my paths in... so, it's not pretty.... but might help you.

This was the origional:

lzc.bat

@ECHO OFF
REM
REM lzc.bat - Bash script to run laszlo compiler.
REM
REM * R_LZ_COPYRIGHT_BEGIN ************************************************** *
REM * Copyright 2001-2005 Laszlo Systems, Inc. All Rights Reserved. *
REM * Use is subject to license terms. *
REM * R_LZ_COPYRIGHT_END ************************************************** ***

call "%LPS_HOME%\WEB-INF\lps\server\bin\lzenv.bat"

set CLASSPATH_SAVE=%CLASSPATH%
set CLASSPATH=%LZCP%
%JAVA_HOME%\bin\java %JAVA_OPTS% -DLPS_HOME="%LPS_HOME%" org.openlaszlo.compiler.Main %1 %2 %3 %4 %5 %6 %7 %8 %9
set CLASSPATH=%CLASSPATH_SAVE%



Which I changed to

lzc.bat


set CLASSPATH=C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lps\server\build;C:\lps-3.2cr2-src\lps-3.2cr2\3RD-PA~1\jars\dev\SERVLE~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\ACTIVA~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\axis.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\BATIK-~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\COMMON~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\COMMON~2.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\COMMON~3.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\COMMON~4.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\CO6683~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\COECE9~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\ftp.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\ISO-RE~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\JAKART~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\jaxrpc.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\jdom.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\jing.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\jython.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\LOG4J-~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\LPS-30~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\saaj.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\SAXON-~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\swflib.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\wsdl4j.jar;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\XMLRPC~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\lib\XPP3-1~1.JAR;C:\lps-3.2cr2-src\lps-3.2cr2\WEB-INF\classes;C:\Tomcat5\common\lib\commons-collections.jar

JAVA -DLPS_HOME="C:\lps-3.2cr2-src\lps-3.2cr2" org.openlaszlo.compiler.Main %1

deng
05-28-2006, 12:37 PM
thanks. I tried all sorts of other ways. All of them failed. In the end, I used the brutal approach as you suggested. It worked! It was really painful because there are so many jar files. I had copy & paste each file name.

I wonder if anyone else has a better solution than this?

JohnH
11-08-2006, 03:43 PM
set JAVA_HOME=C:\Java\jre1.5.0_06
set LPS_HOME=C:\PROGRA~1\OPENLA~1.3\Server\lps-3.3
set LZC=C:\PROGRA~1\OPENLA~1.3\Server\lps-3.3\WEB-INF\lps\server\bin\lzc.bat
set OPT="--runtime=swf8"
echo Setting env
call "%LPS_HOME%\WEB-INF\lps\server\bin\lzenv.bat"
echo Calling compile
%LZC% %OPT% your_canvas.lzx

bfagan
11-09-2006, 05:58 AM
In Eclipse, I keep 2 projects for every Laszlo App. One is a front end (Laszlo code) and the other is the backend (J2EE or somesuch).

Here is the Ant build.xml from the Laszlo project:

<project name="XMFF Laszlo" default="solo-compile-file">

<property file="ant.properties" />

<path id="laszlo.compiler.classpath">
<pathelement location="${openlaszlo.home}/WEB-INF/lps/server/build" />
<pathelement location="${openlaszlo.home}/WEB-INF/classes" />
<fileset dir="${openlaszlo.home}/3rd-party/jars/dev" includes="**/*.jar" />
<fileset dir="${openlaszlo.home}/WEB-INF/lib" includes="**/*.jar" />
</path>

<target name="solo-compile-file" description="Compile the file handed to this target by solo-compile-all-files">
<echo message="Using LPS_HOME: ${openlaszlo.home}" />
<java classpathref="laszlo.compiler.classpath" classname="org.openlaszlo.compiler.Main" fork="yes">
<jvmarg value="-DLPS_HOME=${openlaszlo.home}" />

<arg line="${lzc.args} src/${project.code}.lzx" />
</java>
<move file="src/${project.code}.swf" todir="bin" />
<delete file="src/${project.code}.lzx.swf" />
</target>
</project>

this code uses ant.properties:

openlaszlo.home=c:/Program Files/jboss-4.0.4.GA/server/default/deploy/lps-3.3.3.war
lzc.args=--runtime=swf7
project.code=xmff


In my Java app, I use this Ant build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project name="XMFF" default="deploy">
<property file="ant.properties" />

<target name="packaging_generation" depends="clean,war,ear" />

<target name="war" description="${project.code}.war">
<mkdir dir="build" />
<ant antfile="${laszlo.project}/build.xml" dir="${laszlo.project}" />
<copy file="${laszlo.project}/bin/${project.code}.swf" todir="dist/war" />
<jar manifest="dist/war/META-INF/MANIFEST.MF" destfile="build/${project.code}.war">
<zipfileset dir="dist/war" />
<zipfileset dir="bin" prefix="WEB-INF/classes" />
</jar>
</target>

<target name="ear" description="${project.code}.ear">
<mkdir dir="build" />
<jar destfile="build/${project.code}.ear">
<zipfileset dir="dist/ear" />
<zipfileset file="build/${project.code}.war" />
</jar>
</target>

<target name="clean">
<delete includeemptydirs="true">
<fileset dir="build" includes="**/*" />
</delete>
</target>

<target name="deploy" depends="packaging_generation" description="deploy">
<copy file="build/${project.code}.ear" toDir="${jboss.home}/server/default/deploy" overwrite="true" />
</target>

<target name="test-build" depends="deploy">
<sleep seconds="${browser.delay}" />

<exec executable="${browser}" spawn="true">
<arg value="${test.url}" />
</exec>
</target>

<target name="undeploy" description="undeploy">
<delete file="${jboss.home}/server/default/deploy/${project.code}.ear" />
</target>

</project>

with this ant.properties:

jboss.home=c:/Program Files/JBoss-4.0.4.GA
laszlo.project=../XMFF-Frontend-Dev
browser=C:/Program Files/Internet Explorer/iexplore.exe
browser.delay=6
test.url=http://localhost:8080/XMFF/?mrn=3181563&visit=000068332055
project.code=xmff


Running the test-build target in the Java project will call the build.xml in the Laszlo project to compile the Laszlo app, then it will deploy my app to JBoss, wait 6 seconds and launch IE. All with just one click!

arten
11-10-2006, 02:55 PM
This is just informational, in case someone in Linux is stuck on this issue.

I was taking my first look at using lzc, and was having all kinds of odd issues trying to get it to compile. By chance, I decided to try using lzc as root rather than a regular user. Voila. I'm sure it's documented somewhere I haven't read. ;)

In any event, by this time I had writted a small hybrid compile script, which I present in all its ugliness. Please feel free to enhance in a reply:

#!/bin/sh

LPS_HOME="/devel/web/lps-3.4.x/Server/lps-3.4.x"
JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun"

LZCP="${LPS_HOME}"/WEB-INF/lps/server/build:
LZCP="${LZCP}"`/usr/bin/find "${LPS_HOME}/3rd-party/jars/dev" | tr '\n' ':'`
LZCP="${LZCP}"`/usr/bin/find "${LPS_HOME}/WEB-INF/lib" | tr '\n' ':'`
LZCP="${LZCP}$ANT_HOME/lib/junit.jar:${LPS_HOME}/WEB-INF/classes"

LZCP="${LZCP}:/devel/web/lps-3.4.x/Server/tomcat-5.0.24/common/lib/commons-collections.jar"
#echo "LZCP is ${LZCP}\n"

#CCCOPT="--runtime=swf8"
CCCOPT="--runtime=swf7"

#${JAVA_HOME}/bin/java ${JAVA_OPTS} -DLPS_HOME="${LPS_HOME}" -cp "$LZCP" org.openlaszlo.compiler.Main "$@" ${CCCOPT} $1
sudo ${JAVA_HOME}/bin/java ${JAVA_OPTS} -DLPS_HOME="${LPS_HOME}" -cp "$LZCP" org.openlaszlo.compiler.Main ${CCCOPT} $1