uploading VJ-built Java classes to Linux

by Bennett Haselton <bennett(at)peacefire.org>

 Date:  Sat, 04 Aug 2001 16:25:33 -0700
 To:  hwg-servers(at)hwg.org
  todo: View Thread, Original
I'm writing a CGI program in Java to be run on a Linux machine.  What is 
the one thing you have to tweak in Visual J++ so that you can create Java 
classes in VJ++ and have them work on a Linux command line?  I'm using VJ++ 
to write it since I like the statement completion and other features of the 
text editor.

I created a new Visual J++ project of type "Console Application", and 
modified the main function of the default Class1 class to print "3":
 >>>
public class Class1
{
	/**
	 * The main entry point for the application.
	 *
	 * @param args Array of parameters passed to the application
	 * via the command line.
	 */
	public static void main (String[] args)
	{
		System.out.println(3);
	}
}
 >>>

Building it in VJ++ produces a Class1.class file and a Project1.exe file 
which outputs "3" when run on the command line.  But when I upload the 
Class1.class file (in binary mode, of course) to the Linux server and run 
"javac Class1.class" from there, I get:
 >>>
server1:/home/bhaselto/web/html/tlnew$ javac Class1.class
java.lang.NoClassDefFoundError: antlr/collections/AST
         at at.dms.kjc.Main.beautifyParseError(Main.java:692)
         at at.dms.kjc.Main.parseFile(Main.java:488)
         at at.dms.kjc.Main.run(Main.java:119)
         at at.dms.kjc.Main.compile(Main.java:449)
         at at.dms.kjc.Main.main(Main.java:432)
 >>>

My first thought was that this error must have been committed thousands of 
times by people trying to do this before, so I did an Alta Vista search for
	"java.lang.NoClassDefFoundError: antlr/collections/AST"
hoping to find other pages discussing this problem.  This technique almost 
always works for tracking down the cause of errors that have been seen 
before by other people; this time, however, it produced nothing useful.

Is this related to the controversy over Sun's charges that Microsoft 
deliberately rigged VJ++ to create classes that could not be run on 
non-Microsoft platforms?  Or is there something simple that I forgot to do?

	-Bennett

bennett(at)peacefire.org     http://www.peacefire.org
(425) 649 9024

HWG: hwg-servers mailing list archives, maintained by Webmasters @ IWA