Hello all:After the last discussion, I started tearing pieces out of the design and making them into their own objects, the biggest being the board object. So far I have a bit of code that initializes and shows the board on screen, as well as a build script to make this into a jar file. I want to be able to learn to package this because eventually I'd like to be able to distribute a program. Here is the code, I've just written #file where file is the file name.
#Board.java public class Board { private String[] board; public Board() { int i; board = new String[9]; for (i = 0; i < 9; i++) { board[i] = " "; } } public void printBoard() { int i,j; System.out.println("|-|-|-|"); for (i = 0; i < 3; i++) { System.out.print("|"); for (j = 0; j < 3; j++) { System.out.print(board[i]+"|"); } System.out.println("\n|-|-|-|"); } } #ttt.java public class ttt { public static void main(String[] args) { Board b = new Board(); b.printBoard(); } } } #ttt.manifest Main-Class: ttt #build.bat @echo off echo compiling: javac ttt.java Board.java echo "packaging: jar cmf ttt.manifest ttt.jar ttt.class Board.class echo removing unwanted files: del /q ttt.class del /q Board.class when I run with: java ttt I get: Exception in thread "main" java.lang.NoClassDefFoundError: ttt Caused by: java.lang.ClassNotFoundException: ttt at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: ttt. Program will exit.Help here is appreciated, I'm baffled why it fails when that class is clearly defined.
-- Thanks, Ty __________View the list's information and change your settings at //www.freelists.org/list/programmingblind