This is how i try to run my JDK via cmd but i always get en error:
______________________________________________________
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Elliona>cd desktop

C:\Documents and Settings\Elliona\Desktop>cd kirby

C:\Documents and Settings\Elliona\Desktop\kirby>path C:\java\bin

C:\Documents and Settings\Elliona\Desktop\kirby>javac payroll.java

C:\Documents and Settings\Elliona\Desktop\kirby>java payroll.java
Exception in thread "main" java.lang.NoClassDefFoundError: payroll/java

C:\Documents and Settings\Elliona\Desktop\kirby>
--------------------------------------------------------------------------------------

and this is my code... is there something wrong or missing?

import java.io.*;
import java.util.*;


public class payroll{
	public static void main(String args[]) throws Exception {

	File employee = new File("employee.txt");
	File dtr = new File("dtr.txt");
	PrintWriter pw = new PrintWriter(dtr);
	Scanner filter = new Scanner(employee);
	Scanner datain = new Scanner(System.in);
	
	String empCode, empName, empLevel;
	String covDate, covMonth, covYear;
	String days[] = {"Monday","Tuesday","Wednesday","Thursday","Friday"};
	String option;
	
	double empSalRate;
	double timeInA=0,timeOutA=0;
	double minLate=0,rph=0,dailyTime=0,weeklyTime=0;
	double dailyIncome=0,weeklyIncome=0,weeklyNet=0,weeklyIncomeA=0;
	double totalOt=0,otIncome=0,otTime=0,tax=0,sss=0,deductions=0,allowance=500;;
	double otIn,otInA=0,otOut,otOutA=0;
	int ctr=0;
	int timeIn, timeOut;

	//Asking for an employee Code:!!!!!!!!!!!!!!!!!!
	System.out.print("Enter an Employee Code:");
	empCode=datain.nextLine();

	
	while(filter.hasNext()){
		if(empCode.equals(filter.nextLine())){
		empName=filter.nextLine();
		empLevel=filter.nextLine();
		empSalRate=filter.nextDouble();

		System.out.println("*************************************");
		System.out.println("Employee Name:"+empName);
		System.out.println("Employee Level:"+empLevel);
		System.out.printf("Salary Rate :Php%.2f\n",empSalRate);
		System.out.println("*************************************");

		pw.println("***********************************");
		pw.println("Employee Code:"+empCode);
		pw.println("Employee Name:"+empName);
		pw.println("Employee Level:"+empLevel);
		pw.println("Salary Rate :Php"+empSalRate+"0");
		pw.println("***********************************");
	
	//Asking for timeIn and timeOut and screening undertime and late:!!!!!!
	
	do {
		System.out.println("------------------------------");
		System.out.print("Enter time in for "+days[ctr]+":");
		timeIn=datain.nextInt();
			if(timeIn>=1700)
				timeInA = 1700;
			else if(timeIn>=1600)
				timeInA = 1600;
			else if(timeIn>=1500)
				timeInA = 1500;
			else if(timeIn>=1400)
				timeInA = 1400;
			else if(timeIn>=1300)
				timeInA = 1300;
			else if(timeIn>=1200)
				timeInA = 1200;
			else if(timeIn>=1100)
				timeInA = 1100;
			else if(timeIn>=1000)
				timeInA = 1000;
			else if(timeIn>=900)
				timeInA = 900;
			else if(timeIn>=800)
				timeInA = 800;
			else if(timeIn<=800)
				{timeInA = 800;
				timeIn = 800;}
		pw.println("Enter time in for "+days[ctr]+"\t:"+timeIn);

		System.out.print("Enter tim out for "+days[ctr]+":");
		timeOut=datain.nextInt();
			if(timeOut>=1700)
				timeOutA = 1700;
			else if(timeOut>=1600)
				timeOutA = 1600;
			else if(timeOut>=1500)
				timeOutA = 1500;
			else if(timeOut>=1400)
				timeOutA = 1400;
			else if(timeOut>=1300)
				timeOutA = 1300;
			else if(timeOut>=1200)
				timeOutA = 1200;
			else if(timeOut>=1100)
				timeOutA = 1100;
			else if(timeOut>=1000)
				timeOutA = 1000;
			else if(timeOut>=900)
				timeOutA = 900;
			else if(timeOut>=800)
				timeOutA = 800;
			else if(timeOut<=800)
				{timeOutA = 800;
				 timeOut = 800;}
		pw.println("Enter time out for "+days[ctr]+"\t:"+timeOut);

		//Formula for dailyTime, weeklyTime and Late:!!!!!!!!!!!!!!!!
		if(timeIn>=1300) {
			minLate=0;
			dailyTime=((timeOutA-timeInA)/100)-minLate;
		}
		else {
			minLate=(timeIn-timeInA)/60;
			dailyTime=(((timeOutA-timeInA)/100)-minLate)-1;
		}
		
		rph=empSalRate/8;
		dailyIncome=dailyTime*rph;
		weeklyTime=weeklyTime+dailyTime;
		weeklyIncome=weeklyIncome+dailyIncome;
		System.out.println(" ");
		System.out.print("Is"+days[ctr]+" a holiday? [Yes=y/No=n]");
		option=datain.next();
			if(option.equals("n")) {
				System.out.println(" ");
				System.out.print("Enter Overtime in for "+days[ctr]+":");
				otIn=datain.nextInt();

				if(otIn>=2200)
					otInA=2200;
				else if(otIn>=2100)
					otInA=2100;
				else if(otIn>=2000)
					otInA=2000;	
				else if(otIn>=1900)
					otInA=1900;
				else if(otIn>=1800)
					otInA=1800;				
				else if(otIn>=1700)
					otInA=1700;
			pw.println("Enter OverTime in for "+days[ctr]+"\t:"+otIn);
		
			System.out.print("Enter Overtime out for "+days[ctr]+": ");
			otOut=datain.nextInt();
			if(otOut>=2200)
				otOutA=2200;
			else if(otOut>=2100)
				otOutA=2100;
			else if(otOut>=2000)
				otOutA=2000;
			else if(otOut>=1900)
				otOutA=1900;
			else if(otOut>=1800)
				otOutA=1800;
			else if(otOut>=1700)
				otOutA=1700;
			pw.println("Enter OverTime out for "+days[ctr]+"\t:"+otOut);
			System.out.println("--------------------------------");
		otTime=(otOutA-otInA)/100;
		totalOt=totalOt+otTime;
		}
			else {
				rph=empSalRate/8;
				dailyIncome=(dailyTime*rph)*1.1;
		}
			weeklyIncomeA=weeklyIncomeA+dailyIncome;
		ctr=ctr+1;// or ctr++
		} while(ctr<=4);
	
			System.out.println("*******************************");	
			System.out.print("Enter Coverage Date: ");
			covMonth=datain.next();
			covDate=datain.next();
			covYear=datain.next();

			otIncome=(totalOt*rph)*1.1;
			weeklyIncomeA=(weeklyIncomeA+otIncome);
			tax=weeklyIncome*.1;
			sss=weeklyIncome*.01;
			deductions=(tax+sss);
			weeklyNet=(weeklyIncomeA-deductions)+allowance;
			pw.println("********************************");
			pw.print("Enter Coverage Date: ");
			System.out.print(" ");
			
		System.out.println("========================================");
		System.out.println("========  TESDA Payroll System   =======");
		System.out.println("========================================");
		System.out.println("Employee Name: "+empName);
		System.out.println("Employee Code: "+empCode);
		System.out.println("Employee Level: "+empLevel);
		System.out.printf("Salary Rate :Php %.2f",empSalRate);
		System.out.println("/day");

		System.out.println("*****************************************");
		System.out.println("Date Covered\t: "+covMonth+" "+covDate+","+covYear);
		System.out.printf("TOtal Number of Work Hours: %.0f",weeklyTime);
		System.out.println(" Hours");
		System.out.printf("OverTime Hours\t: %.0f",totalOt);
		System.out.println(" Hourse");
		System.out.printf("Regular Income\t: "+"Php %.2f\n",weeklyIncome);
		System.out.printf("OverTime Income\t: "+"Php %.2f\n",otIncome);
		System.out.printf("Gross Income\t: "+"Php %.2f\n",weeklyIncomeA);
		System.out.println("Deductions:");
		System.out.printf(" *Tas: %.2f\n",tax);
		System.out.printf(" *SSS: %.2f\n",sss);
		System.out.println("******************************************");
		System.out.printf("****  Net Income: Php %.2f",weeklyNet);
		System.out.println(" *********");
		System.out.println("******************************************");
			pw.close();
			}
		     } 
			
			filter.close();
		}
	}

No problem in the class. When you run the program you need to use just the class name drop the .java file extension. javac invokes the compiler and transforms the source file (.java) into a bytecode file (.class) then you run the program by supplying the compiled bytecode file (.class) to the java command that invokes the JVM.

You don't specify the .java extension when executing Java programs since you are no longer concerned with .java files [the javac command compiles your Java files to the bytecode which is placed in .class files). Read the documentation of the `java' command for more details.

Edit: D'oh, beaten.

whats the format inside ur employee.txt??

whats the format inside ur employee.txt??

Whats that gotta do with the "ClassDefNotFound" error in java?

i can run the program but it stucks with the "Enter Employee Code:"

No actually running itself was his problem, since he was using the .java extension to the filename while running.

how to start the payroll system? can you give me a basic codes?

shela: this thread is 4 years old. no point in reviving it.
also: the code to run is in the original post. so what 'basic code' are you looking for?

if you don't understand that code, or don't agree with how it was written, do what anyone else would do: write your own.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.