Making a java .jar File using NetBeans 6.8

Making a java .jar File using NetBeans 6.8

1.	Open a java project in NetBeans

2.	Run the project once (to check everything is just working fine)

3.	Select your project and go to Propertise 
or, File > Project Propertise (ur project name)

4.	A dialog box will appear, titled : Project Propertise

5.	Under Catergories : Build > Packaging 

6.	Checked the Compress JAR File & Build JAR after Compiling

7.	Ok

8.	Select your project and click Clean & Build 
or, Run > Clean and Build Project 
or, shift + F11

9.	That’s all. Now go to your project folder and there you will find a folder named dist containing the .jar file

ACM (TJU) : 3059


package volume_XXI;

import java.util.Scanner;

public class Id_3059 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in); 
		
		int testCase = input.nextInt();
		
		while ( testCase-- > 0 ) {
			
			int round = input.nextInt();
			int player1 = 0;
			int player2 = 0;
			
			for ( int i = 0; i < round; i++ ) {
				
				String first = input.next();
				String second = input.next();
				
				if ( !first.equals(second) ) {
					if ( call ( first, second ))
						player1++;
					else
						player2++;
				}
				
			}
			
			if ( player1 > player2 )
				System.out.println ("Player 1");
			else if ( player1 == player2)
				System.out.println ("TIE");
			else
				System.out.println ("Player 2");	
		}
	}
	
	static boolean call (String a, String b) {
		
		if ( a.equals("R") && b.equals("S") )
			return true;
		
		if ( a.equals("S") && b.equals("P") )
			return true;
		
		if ( a.equals("P") && b.equals("R") )
			return true;
		
		return false;
	}
}

ACM (TJU) : 3004


package volume_XXI;

import java.util.Scanner;

public class Id_3004 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in);
		
		int dataSet = input.nextInt();
		int testCase = 0;
		
		while ( dataSet-- > 0 ) {
			
			int m = input.nextInt();
			String s = input.next();
			
			System.out.print (++testCase + " ");
			
			for ( int i = 0; i < s.length(); i++ ) {
				if ( i + 1 == m )
					continue;
				System.out.print(s.charAt(i));
			}
			System.out.println ();
		}
	}
}


ACM (TJU) : 3161


package volume_XXII;

import java.util.Scanner;

public class Id_3161 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in); 
		
		int n = input.nextInt();
		int nArray [] = new int [502];
		
		int q = input.nextInt();
		
		for ( int i = 0; i < n; i++ )
			nArray [i] = input.nextInt();
		
		for ( int i = 0; i < q; i++ ) {
			int s_j = input.nextInt();
			int e_j = input.nextInt();
			
			int sum = 0;
			
			while ( s_j <= e_j ) {
				sum += nArray [s_j - 1];
				s_j++;
			}
			
			System.out.println (sum);
		}
	}
}


ACM (TJU) : 1939


package volume_X;

import java.util.Scanner;

public class Id_1939 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in);
		
		int n = input.nextInt();
		int a [] [] = new int [15] [2];
		
		while ( n != -1 ) {
			
			for ( int i = 0; i < n; i++ ) {
				a [i] [0] = input.nextInt();
				a [i] [1] = input.nextInt();
			}
			
			int speed = a [0] [0] * a [0] [1];
			
			for ( int i = 1; i < n; i++ )
				speed += ( a [i] [0] * (a [i] [1] - a [i - 1] [1]));
			
			System.out.printf ("%d miles\n", speed);
			n = input.nextInt();
		}

	}

}


ACM (TJU) : 3205


package volume_XXIII;

import java.util.Arrays;
import java.util.Scanner;

public class Id_3205 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Scanner input = new Scanner (System.in);

		int n = input.nextInt();
		int a [] [] = new int [100] [100];

		for  (int i = 0; i < n; i++ ) {
			for ( int j = 0; j < n; j++ )
				a [i] [j] = input.nextInt();
			Arrays.sort(a [i], 0, n);
		}

		int res [] = new int [n];

		for ( int i = 0; i < n; i++ )
			res [i] = a [i] [ n / 2 ];

		Arrays.sort(res);

		System.out.println (res [n/2]);
	}
}

ACM (TJU) : 2001


package volume_XI;

import java.util.Scanner;

public class Id_2001 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in);
		
		int n = input.nextInt();
		int testCase = 0;
		
		while ( n != 0 ) {
			int m = input.nextInt();
			int count = 0;
			String s;
			
			while ( m != 0 ) {
				s = input.next();
				if ( s.equals("sheep"))
					count++;
				m--;
			}
			System.out.printf("Case %d: This list contains %d sheep.\n", ++testCase, count);
			if ( n != 1 )
				System.out.println ();
			n--;
		}
	}
}


ACM (TJU) : 2803


package volume_XIX;

import java.util.Scanner;

public class Id_2803 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in);
		
		int testCase = input.nextInt();
		
		while ( testCase != 0 ) {
			double a = input.nextDouble();
			double b = input.nextDouble();
			double c = input.nextDouble();
			
			double sq = b * b - 4 * a * c;
			if ( sq < 0 )
				System.out.println ("No solution!");
			
			else {
				double sq1 = -b + Math.sqrt(sq);
				sq1 /= (2 * a);
				
				double sq2 = -b - Math.sqrt(sq);
				sq2 /= (2 * a);
				
				if ( sq1 == sq2 )
					System.out.printf ("%.3f\n", sq1);
				else if ( sq1 > sq2 )
					System.out.printf ("%.3f %.3f\n", sq2, sq1 );
				else
					System.out.printf ("%.3f %.3f\n", sq1, sq2 );
			}
			testCase--;
		}
	}
}


ACM (TJU) : 3251


package volume_XXIII;

import java.util.Scanner;

public class Id_3251 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in);
		
		int d = input.nextInt();
		int m = input.nextInt();
		
		int days [] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
		int week = 6;
		
		outer:
		for ( int i = 1; i <= 12; i++ ) {
			for ( int j = 1; j <= days [i - 1]; j++ ) {
				if ( i == m && j == d ) 
					break outer;
				if ( week % 7 == 0 )
					week = 0;
				week++;
			}
		}
		
		switch (week) {
		case 1:
			System.out.println ("Saturday");
			break;
		case 2:
			System.out.println ("Sunday");
			break;
		case 3:
			System.out.println ("Monday");
			break;
		case 4:
			System.out.println ("Tuesday");
			break;
		case 5:
			System.out.println ("Wednesday");
			break;
		case 6:
			System.out.println ("Thursday");
			break;
		case 7:
			System.out.println ("Friday");
			break;
		}
	}
}


ACM (UVa) : 10664


package volume_CVI;

import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Id_10664 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in);   
		
		String s;
		String temp;
		int m = input.nextInt();
		s = input.nextLine();
		
		while ( m != 0 ) {
			
			int array [] = new int [250];
			int i = 0 ;
			
			s = input.nextLine();
			StringTokenizer stok = new StringTokenizer (s);
			
			while ( stok.hasMoreElements()) {
				temp = stok.nextToken();
				array [i++] = Integer.parseInt(temp);
			}
			
			Arrays.sort(array);
			int hand1 = 0;
			int hand2 = 0;
			
			int j = 0;
			
			while ( j < i ) {
				
				if ( hand1 >= hand2 )
					hand2 += array [array.length - j - 1];
				
				else
					hand1 += array [array.length - j - 1];
				j++;
			}
		
			if ( hand1 - hand2 == 0 )
				System.out.println ( "YES" );
			else
				System.out.println ( "NO" );
			m--;
		}
	}
}


Follow

Get every new post delivered to your Inbox.

Join 48 other followers