- Jun 15, 2000
- 46
- 0
- 0
Hi, I am a newbie at JAVA and I am learning JAVA with Core JAVA2 from SUN... but I am having a bit of trouble with setting classpath with JAVA in windows98. The following is the code...
/**
* @version 1.20 27 Mar 1998
* @author Cay Horstmann
*/
import corejava.*;
public class Calendar
{ public static void main(String[] args)
{ int m;
int y;
if (args.length == 2)
{ m = Integer.parseInt(args[0]);
y = Integer.parseInt(args[1]);
}
else
{ Day today = new Day(); // today's date
m = today.getMonth();
y = today.getYear();
}
Day d = new Day(y, m, 1); // start date of the month
System.out.println(m + " " + y);
System.out.println("Sun Mon Tue Wed Thu Fri Sat"
;
for (int i = Day.SUNDAY; i < d.weekday(); i++ )
System.out.print(" "
;
while (d.getMonth() == m)
{ if (d.getDay() < 10) System.out.print(" "
;
System.out.print(d.getDay());
if (d.weekday() == Day.SATURDAY)
System.out.println();
else
System.out.print(" "
;
d.advance(1);
}
if (d.weekday() != Day.SUNDAY) System.out.println();
}
}
I know that I have to set classpath in order to import "corejava.*" files from a directory, but I haven't had much luck with this... I tried to add classpath in autoexec.bat like "set classpath=path" but no luck there...
Can anyone help me with this? Thanks in advance...
/**
* @version 1.20 27 Mar 1998
* @author Cay Horstmann
*/
import corejava.*;
public class Calendar
{ public static void main(String[] args)
{ int m;
int y;
if (args.length == 2)
{ m = Integer.parseInt(args[0]);
y = Integer.parseInt(args[1]);
}
else
{ Day today = new Day(); // today's date
m = today.getMonth();
y = today.getYear();
}
Day d = new Day(y, m, 1); // start date of the month
System.out.println(m + " " + y);
System.out.println("Sun Mon Tue Wed Thu Fri Sat"
for (int i = Day.SUNDAY; i < d.weekday(); i++ )
System.out.print(" "
while (d.getMonth() == m)
{ if (d.getDay() < 10) System.out.print(" "
System.out.print(d.getDay());
if (d.weekday() == Day.SATURDAY)
System.out.println();
else
System.out.print(" "
d.advance(1);
}
if (d.weekday() != Day.SUNDAY) System.out.println();
}
}
I know that I have to set classpath in order to import "corejava.*" files from a directory, but I haven't had much luck with this... I tried to add classpath in autoexec.bat like "set classpath=path" but no luck there...
Can anyone help me with this? Thanks in advance...