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 (); } } } [/sourcecode]

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); } } } [/sourcecode]

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(); } } } [/sourcecode]

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]); } } [/sourcecode]

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--;
		}
	}
}