## Monday, April 28, 2008

Seriously though, those IDE's are really great programs, but sometimes you can't install them, or they're not available on your system, or you just need something minimal and fast. Fortunately, Intralink contains everything we need to compile J-Link applications: a JRE and tools.jar. tools.jar is the codebase from Javasoft that contains Java compilation code.

Here is a batch file that will compile J-Link Java code on Windows:

@echo offrem jlink_javac.bat - Compile JLink Apps using Intralink JDKset Proe_Install_Dir=c:\ptc\proeWildfire2.0_m200set IL_Install_Dir=c:\ptc\proiclient3.3_m021set CLASSPATH=%IL_Install_Dir%\i486_nt\lib\tools.jarset path=%IL_Install_Dir%\i486_nt\jre\bin;%path%java sun.tools.javac.Main -classpath %Proe_Install_Dir%\text\java\pfc.jar -d . %*

Run it like this:

jlink_javac.bat Abc.java Def.java Ghi.java

Here is a C shell script that will compile J-Link Java code on Unix:

#!/bin/csh# jlink_javac.csh - Compile JLink Apps using Intralink JDKsetenv Proe_Install_Dir /opt/proeWildfire2.0_m200setenv IL_Install_Dir /opt/proiclient3.3_m021setenv CLASSPATH $IL_Install_Dir/sun4_solaris/lib/tools.jarset path=($IL_Install_Dir/sun4_solaris/jre/bin $path )java sun.tools.javac.Main -classpath$Proe_Install_Dir/text/java/pfc.jar -d . \$*

Run it like this:

jlink_javac.csh Abc.java Def.java Ghi.java

The resulting class files will be in the current directory. While I do use this for my own J-Link code which is typically targeted at Java 1.4.2, it may not work with newer Java versions, nor take advantage of their full capabilities. However, for you command line junkies out there, this is just the recipe.

nomoslogos said...
This comment has been removed by the author.
nomoslogos said...

Very helpful! It works great for compiling, but when I tried to run the compiled program in Intralink it won't run. I get a blank error message box.
I was trying to compile my Intralink script this way becuase when I compile two related class files Intralink, it doesn't recognize the helper class when I compile the main class.
Any idea what I'm doing wrong when compiling in I-link, or does it only recognize one file at a time?
Thanks for the very informative blog!