LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-23-2008, 06:26 PM   #1
rabbit2345
Member
 
Registered: Apr 2007
Location: 中国上海
Distribution: openSUSE 11.3
Posts: 369

Rep: Reputation: 40
how to run .class java file?


Hi,

I have a .class file sitting on my computer and i want to run it sometimes on someone else's computer, but i can only execute my program with the javawrapper command. If i use the regular java command, then i get this output:

Code:
Exception in thread "main" java.lang.NoClassDefFoundError: /home/brian/Desktop/Horserace10/class
what does this mean??

another thing is i want to package this file into a jar file to make it less troublesome, but i have read all the tutorials and still have no clue what i have to do. Do i have to package all the things i imported like java.io.* with the package? and if so, do i have to modify my code to make it use the jar file resources?

here is my code if it helps:

Code:
import java.io.*;
import java.util.*;

public class Horserace10
{
	static Random gen = new Random();

	public static void fx1()
	{
		int horse[] = new int[10];
		int x, y, rand, a, p, d, z;
		String n, pt, h;
		Scanner p1, p2, p1h, p1b, p2h, p2b, hold;
		horse[0] = 0;
		horse[1] = 0;
		horse[2] = 0;
		horse[3] = 0;
		horse[4] = 0;
		horse[5] = 0;
		horse[6] = 0;
		horse[7] = 0;
		horse[8] = 0;
		horse[9] = 0;
		rand = gen.nextInt(300);
		System.out.print("Welcome to the Horse Race Game!" + "\n\n");
		System.out.print("Enter Player 1's name" + "\n\n");
		p1 = new Scanner(System.in);
		n = p1.nextLine();
		System.out.print("\n\nEnter Player 2's name" + "\n\n");
		p2 = new Scanner(System.in);		
		pt = p2.nextLine();
		System.out.print("\nEnter the horse number " + n + " wants to bet on" + " (1 - 10)" + "\n\n#");
		p1h = new Scanner(System.in);
		x = p1h.nextInt();
		System.out.print("\nEnter how much money " + n + " wants to bet on Horse #" + x + "\n\n$");
		p1b = new Scanner(System.in);
		y = p1b.nextInt();
		System.out.print("\nEnter the horse number " + pt + " wants to bet on\n\n#");
		p2h = new Scanner(System.in);
		p = p2h.nextInt();
		System.out.print("\nEnter how much money " + pt + " wants to bet on Horse #" + p + " \n\n$");
		p2b = new Scanner(System.in);
		d = p2b.nextInt();
		System.out.print("\nThe race has started!!, Press enter to continue the race");
		a = rand + y + d;
		z = rand + d + y;
		do
		{
			System.out.print("\n");

			for (int track = 0; track < 10; track++)
			{
				System.out.print("\n\n|");
				for (int i = 0; i < 75; i++)
				{
					if (i != horse[track])
					{
						System.out.print("-");
					}
					else
					{
						System.out.print(track + 1);
					}

				}
				System.out.print("|");
			}
			hold = new Scanner(System.in);
			h = hold.nextLine();
			horse[0] += gen.nextInt(3) + 1;
			horse[1] += gen.nextInt(3) + 1;
			horse[2] += gen.nextInt(3) + 1;
			horse[3] += gen.nextInt(3) + 1;
			horse[4] += gen.nextInt(3) + 1;
			horse[5] += gen.nextInt(3) + 1;
			horse[6] += gen.nextInt(3) + 1;
			horse[7] += gen.nextInt(3) + 1;
			horse[8] += gen.nextInt(3) + 1;
			horse[9] += gen.nextInt(3) + 1;
		}
		while (horse[0] <= 75 && horse[1] <= 75 && horse[2] <= 75 && horse[3] <= 75 && horse[4] <= 75 && horse[5] <= 75 && horse[6] <= 75 && horse[7] <= 75 && horse[8] <= 75 && horse[9] <= 75);

		if (horse[0] > 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 && horse[7] < 75 && horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 won the race!!");
		}
		if (horse[1] > 75 && horse[0] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 && horse[7] < 75 && horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 2 won the race!!");
		}
		if (horse[2] > 75 && horse[1] < 75 && horse[0] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 && horse[7] < 75 && horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 3 won the race!!");
		}
		if (horse[3] > 75 && horse[1] < 75 && horse[2] < 75 && horse[0] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 && horse[7] < 75 && horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 4 won the race!!");
		}
		if (horse[4] > 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[0] < 75 && horse[5] < 75 && horse[6] < 75 && horse[7] < 75 && horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 5 won the race!!");
		}
		if (horse[5] > 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[0] < 75 && horse[6] < 75 && horse[7] < 75 && horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 6 won the race!!");
		}
		if (horse[6] > 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[0] < 75 && horse[7] < 75 && horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 7 won the race!!");
		}
		if (horse[7] > 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 && horse[0] < 75 && horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 8 won the race!!");
		}
		if (horse[8] > 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 && horse[7] < 75 && horse[0] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 9 won the race!!");
		}
		if (horse[9] > 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 && horse[7] < 75 && horse[8] < 75 && horse[0] < 75)
		{
			System.out.print("			Horse 10 won the race!!");
		}
		if (horse[0] > 75 && horse[1] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 and 2 tied!!");
		}
		if (horse[0] > 75 && horse[2] > 75 && horse[1] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 and 3 tied!!");
		}
		if (horse[0] > 75 && horse[3] > 75 && horse[2] < 75 && horse[1] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 and 4 tied!!");
		}
		if (horse[0] > 75 && horse[4] > 75 && horse[2] < 75 && horse[3] < 75 && horse[1] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 and 5 tied!!");
		}
		if (horse[0] > 75 && horse[5] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[1] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 and 6 tied!!");
		}
		if (horse[0] > 75 && horse[6] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[1] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 and 7 tied!!");
		}
		if (horse[0] > 75 && horse[7] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[1] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 and 8 tied!!");
		}
		if (horse[0] > 75 && horse[8] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[1] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 1 and 9 tied!!");
		}
		if (horse[0] > 75 && horse[9] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[1] < 75)
		{
			System.out.print("			Horse 1 and 10 tied!!");
		}
		if (horse[1] > 75 && horse[2] > 75 && horse[0] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 2 and 3 tied!!");
		}
		if (horse[1] > 75 && horse[3] > 75 && horse[2] < 75 && horse[0] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 2 and 4 tied!!");
		}
		if (horse[1] > 75 && horse[4] > 75 && horse[2] < 75 && horse[3] < 75 && horse[0] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 2 and 5 tied!!");
		}
		if (horse[1] > 75 && horse[5] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[0] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 2 and 6 tied!!");
		}
		if (horse[1] > 75 && horse[6] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[0] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 2 and 7 tied!!");
		}
		if (horse[1] > 75 && horse[7] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[0] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 2 and 8 tied!!");
		}
		if (horse[1] > 75 && horse[8] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[0] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 2 and 9 tied!!");
		}
		if (horse[1] > 75 && horse[9] > 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[0] < 75)
		{
			System.out.print("			Horse 2 and 10 tied!!");
		}
		if (horse[2] > 75 && horse[3] > 75 && horse[1] < 75 && horse[0] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 3 and 4 tied!!");
		}
		if (horse[2] > 75 && horse[4] > 75 && horse[1] < 75 && horse[3] < 75 && horse[0] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 3 and 5 tied!!");
		}
		if (horse[2] > 75 && horse[5] > 75 && horse[1] < 75 && horse[3] < 75 && horse[4] < 75 && horse[0] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 3 and 6 tied!!");
		}
		if (horse[2] > 75 && horse[6] > 75 && horse[1] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[0] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 3 and 7 tied!!");
		}
		if (horse[2] > 75 && horse[7] > 75 && horse[1] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[0] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 3 and 8 tied!!");
		}
		if (horse[2] > 75 && horse[8] > 75 && horse[1] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[0] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 3 and 9 tied!!");
		}
		if (horse[2] > 75 && horse[9] > 75 && horse[1] < 75 && horse[3] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[0] < 75)
		{
			System.out.print("			Horse 3 and 10 tied!!");
		}
		if (horse[3] > 75 && horse[4] > 75 && horse[2] < 75 && horse[1] < 75 && horse[0] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 4 and 5 tied!!");
		}
		if (horse[3] > 75 && horse[5] > 75 && horse[2] < 75 && horse[1] < 75 && horse[4] < 75 && horse[0] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 4 and 6 tied!!");
		}
		if (horse[3] > 75 && horse[6] > 75 && horse[2] < 75 && horse[1] < 75 && horse[4] < 75 && horse[5] < 75 && horse[0] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 4 and 7 tied!!");
		}
		if (horse[3] > 75 && horse[7] > 75 && horse[2] < 75 && horse[1] < 75 && horse[4] < 75 && horse[5] < 75 && horse[0] < 75 &&  horse[6] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 4 and 8 tied!!");
		}
		if (horse[3] > 75 && horse[8] > 75 && horse[2] < 75 && horse[1] < 75 && horse[4] < 75 && horse[5] < 75 && horse[0] < 75 &&  horse[7] < 75 &&  horse[6] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 4 and 9 tied!!");
		}
		if (horse[3] > 75 && horse[9] > 75 && horse[2] < 75 && horse[1] < 75 && horse[4] < 75 && horse[5] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[0] < 75)
		{
			System.out.print("			Horse 4 and 10 tied!!");
		}
		if (horse[4] > 75 && horse[5] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 5 and 6 tied!!");
		}
		if (horse[4] > 75 && horse[6] > 75 && horse[5] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[0] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 5 and 7 tied!!");
		}
		if (horse[4] > 75 && horse[7] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[6] < 75 &&  horse[5] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 5 and 8 tied!!");
		}
		if (horse[4] > 75 && horse[8] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[5] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 5 and 9 tied!!");
		}
		if (horse[4] > 75 && horse[9] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[6] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[5] < 75)
		{
			System.out.print("			Horse 5 and 10 tied!!");
		}
		if (horse[5] > 75 && horse[6] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 6 and 7 tied!!");
		}
		if (horse[5] > 75 && horse[7] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 &&  horse[6] < 75 &&  horse[8] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 6 and 8 tied!!");
		}
		if (horse[5] > 75 && horse[8] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 &&  horse[7] < 75 &&  horse[6] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 6 and 9 tied!!");
		}
		if (horse[5] > 75 && horse[9] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 &&  horse[7] < 75 &&  horse[8] < 75 && horse[6] < 75)
		{
			System.out.print("			Horse 6 and 10 tied!!");
		}
		if (horse[7] > 75 && horse[8] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 &&  horse[5] < 75 &&  horse[6] < 75 && horse[9] < 75)
		{
			System.out.print("			Horse 8 and 9 tied!!");
		}
		if (horse[7] > 75 && horse[9] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 &&  horse[5] < 75 &&  horse[6] < 75 && horse[8] < 75)
		{
			System.out.print("			Horse 8 and 10 tied!!");
		}
		if (horse[8] > 75 && horse[9] > 75 && horse[0] < 75 && horse[1] < 75 && horse[2] < 75 && horse[3] < 75 && horse[4] < 75 &&  horse[5] < 75 &&  horse[6] < 75 && horse[7] < 75)
		{
			System.out.print("			Horse 9 and 10 tied!!");
		}
		if (horse[0] > 75 && x == 1 || horse[1] > 75 && x == 2 || horse[2] > 75 && x == 3 || horse[3] > 75 && x == 4 || horse[4] > 75 && x == 5 || horse[5] > 75 && x == 6 || horse[6] > 75 && x == 7 || horse[7] > 75 && x == 8 || horse[8] > 75 && x == 9 || horse[9] > 75 && x == 10)
		{
			a += y;
			System.out.print("\n\n		" + n + " has bet on the right horse! " + n + " won $" + a + "!!");
		}

		if (horse[0] < 75 && x == 1 || horse[1] < 75 && x == 2 || horse[2] < 75 && x == 3 || horse[3] < 75 && x == 4 || horse[4] < 75 && x == 5  || horse[5] < 75 && x == 6 || horse[6] < 75 && x == 7  || horse[7] < 75 && x == 8  || horse[8] < 75 && x == 9  || horse[9] < 75 && x == 10)
		{
			a -= y;
			System.out.print("\n\n		" + n + " has bet on the wrong horse! " + n + " lost $" + y + "!!");
		}
		if (x > 10 || x < 1)
		{
			System.out.print("\n\n		" + n + " bet on a non-exsisting horse, so " + n + " lost $" + y + "!!");
		}
		if (horse[0] > 75 && p == 1 || horse[1] > 75 && p == 2 || horse[2] > 75 && p == 3 || horse[3] > 75 && p == 4 || horse[4] > 75 && p == 5 || horse[5] > 75 && p == 6 || horse[6] > 75 && p == 7 || horse[7] > 75 && p == 8 || horse[8] > 75 && p == 9 || horse[9] > 75 && p == 10)
		{
			a += d;
			System.out.print("\n\n		" + pt + " has bet on the right horse! " + pt + " won $" + z + "!!");
		}
		if (horse[0] < 75 && p == 1 || horse[1] < 75 && p == 2 || horse[2] < 75 && p == 3 || horse[3] < 75 && p == 4 || horse[4] < 75 && p == 5 || horse[5] < 75 && p == 6 || horse[6] < 75 && p == 7 || horse[7] < 75 && p == 8 || horse[8] < 75 && p == 9 || horse[9] < 75 && p == 10)
		{
			a -= d;
			System.out.print("\n\n		" + pt + " has bet on the wrong horse! " + pt + " lost $" + d + "!!");
		}
		if (p > 10)
		{
			System.out.print("\n\n		" + pt + " bet on a non-exsisting horse, so " + pt + " lost $" + d + "!!");
		}
	}
	public static void main(String[] args)
    {
for (int lo = 0; lo < 10; lo++)
	{
	int ch;
	Scanner choice;		
	fx1();
	System.out.print("\n\n	Nice Race!! If you want to play again, type 1 or type 2 to exit\n:");
	choice = new Scanner(System.in);
	ch = choice.nextInt();
		if (ch == 1)
		{ 
		System.out.print("\n\nHorse Race 10 is restarting...Done\n\n\n");
		lo = 2;
		}
		if (ch == 2)
		{
		System.out.print("\n\nHorse Race 10 is exiting... :(\n\n\nThanks for playing Horse Race 10!\n\n");
		lo = 15;
		}
	}
    }
}

Thanks,
Rabbit2345
 
Old 01-24-2008, 12:10 AM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
lets imagine i have a java source code file called "Fubar.java". to compile the file, i would do javac Fubar.java (which isnt what your asking but oh well). this creates the java bytecode file named Fubar.class, which can then be executed (on any computer with the proper version of the JRE) with the command java Fubar, note you leave out any extension when running the file.

regarding the jar, im not sure. i imagine theres utilities that came with the JDK to ease the process. i highly doubt you have to include any standard java packages, such as java.io for example--just put in your files (or any other non-standard files).

hope it helps
 
Old 01-24-2008, 10:43 AM   #3
Seagull
Member
 
Registered: Oct 2003
Location: Holland
Distribution: SuSE 10.0 SuSE 10.2
Posts: 70

Rep: Reputation: 15
Quote:
Usage: jar {ctxu}[vfm0Mi] [jar-file] [manifest-file] [-C dir] files ...
Options:
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-u update existing archive
-v generate verbose output on standard output
-f specify archive file name
-m include manifest information from specified manifest file
-0 store only; use no ZIP compression
-M do not create a manifest file for the entries
-i generate index information for the specified jar files
-C change to the specified directory and include the following file
If any file is a directory then it is processed recursively.
The manifest file name and the archive file name needs to be specified
in the same order the 'm' and 'f' flags are specified.

Example 1: to archive two class files into an archive called classes.jar:
jar cvf classes.jar Foo.class Bar.class
Example 2: use an existing manifest file 'mymanifest' and archive all the
files in the foo/ directory into 'classes.jar':
jar cvfm classes.jar mymanifest -C foo/ .
So in it's simplest case you'd do jar cvf HorseRace.jar HorseRace10.class which would then give you the jar file HorseRace.jar
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a java jar file. sabliny Programming 7 11-05-2005 01:59 PM
Java FTP file class? caged Programming 3 03-19-2005 09:01 PM
executing java class file niranjan_mr Linux - Software 1 12-27-2004 02:03 PM
How to run java class everyday automatic?? karleong Linux - Newbie 5 07-15-2003 07:51 AM
can't run java class files in linux JIV Programming 6 03-25-2003 01:20 AM


All times are GMT -5. The time now is 04:52 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration