Bad Class Error
D:\myPROJECT>javac GetVersion.java
GetVersion.java:14: cannot access GeneralParameters
bad class file: D:\myPROJECT\comm\GeneralParameters.class
class file contains wrong class: myPROJECT.comm.GeneralParameters
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
public GeneralParameters generalParameters;
^
1 error
Java tells that GeneralParameters.class is a bad class while it exist in the correct directory or package. GetVersion.java is the one that call GeneralParameters.class. I compiled succesfully the GeneralParameters.java and produce a class.Can anyone tell me what went wrong?What is the cause of this error?Im new to java and I try to self study it and theres no one I can ask for help(Sorry if I get a wrong grammar ). Thankfully im a member of this community......hehehehehe.
thnx in advance to all help
Im willing to post my codes if needed.
[969 byte] By [
foxfirea] at [2007-10-2 11:49:20]

This is the codes of GetVersion.java
import myPROJECT.comm.*;//this is a package
import myPROJECT.serial.SerialCommunication;
import java.io.CharArrayWriter;
import java.io.PrintStream;
import communication.PacketExchange;//this is a package
public class GetVersion
{
public GeneralParameters generalParameters;
public SerialCommunication serialCommunication;
public PacketExchange packetExchange;
public GetVersion()
{
generalParameters = new GeneralParameters();
serialCommunication = new SerialCommunication();
packetExchange = new PacketExchange();
}
public static void main(String args[])
{
GetVersion getversion = new GetVersion();
getversion.performRequestedActions(args);
}
private void performRequestedActions(String as[])
{
generalParameters.setParameters(as);
if(!serialCommunication.openRequestedPort(generalParameters))
{
System.out.println();
System.out.println("Error opening or configuring port");
System.exit(1);
}
packetExchange.getClass();
if(!packetExchange.sendPacket(generalParameters, 1, new int[0], serialCommunication.getOutputStream()))
{
System.out.println();
System.out.println("Error sending data to reader");
System.exit(1);
}
packetExchange.displayPacket(true);
if(!packetExchange.receivePacket(serialCommunication.getInputStream()))
{
System.out.println();
System.out.println("Error in response or no response");
System.exit(1);
}
packetExchange.displayPacket(false);
packetExchange.getClass();
if((packetExchange.getPacketFlags() & 4) == 0)
interpretResult(packetExchange.getPacketData());
}
private void interpretResult(int ai[])
{
String as[] = {
"COM", "USB", "BlueTooth"
};
CharArrayWriter chararraywriter = new CharArrayWriter();
System.out.println();
System.out.println("Reader version info:");
System.out.println((new StringBuilder()).append("Software version ").append(Integer.toString(ai[0])).append(".").append(Integer.toString(ai[1])).append(".").append(Integer.toString(ai[2])).append(".").toString());
System.out.print("Reader type is ");
if(ai[3] > 2)
System.out.println("unknown.");
else
System.out.println((new StringBuilder()).append(as[ai[3]]).append(".").toString());
for(int i = 6; i < ai.length; i++)
chararraywriter.write(ai);
System.out.println(chararraywriter.toString());
}
}
this is the codes of GeneralParameters.java
package myPROJECT.comm;
public class GeneralParameters
{
public GeneralParameters()
{
baudRate = 9600;
comPort = "COM1";
useCRC = true;
useAddr = false;
}
public void setParameters(String args[])
{
for(int i = 0; i < args.length; i++)
{
if(args.equals("-b"))
{
if(++i >= args.length)
continue;
try
{
baudRate = Integer.parseInt(args);
}
catch(NumberFormatException e) { }
continue;
}
if(args.equals("-d"))
{
if(++i < args.length)
comPort = args;
continue;
}
if(args.equals("-nocrc"))
{
useCRC = false;
continue;
}
if(!args.equals("-addr") || ++i >= args.length)
continue;
try
{
addr = Integer.parseInt(args);
useAddr = true;
}
catch(NumberFormatException e) { }
}
}
public int getBaudRate()
{
return baudRate;
}
public String getComPort()
{
return comPort;
}
public boolean getUseCRC()
{
return useCRC;
}
public boolean getUseAddr()
{
return useAddr;
}
public int getAddr()
{
return addr;
}
public void setBaudRate(int newBaud)
{
baudRate = newBaud;
}
private int baudRate;
private String comPort;
private boolean useCRC;
private boolean useAddr;
private int addr;
private final String swBaudRate = "-b";
private final String swComPort = "-d";
private final String swNoCRC = "-nocrc";
private final String swUseAddr = "-addr";
}
The GetVersion.java resides in D:\myPROJECT\ while the GeneralParameters.class resides in D:\myPROJECT\comm\
thanx in advance to all help