Duplicate class error message
Hi,
Does anyone know what a duplicate class error message means and how to resolve it?
It just does not make any sense to me as there is only one instance of the class yet the compiler is throwing out a duplicate class error message.
I copied your experiment and had no trouble compiling the four classes (A, B, C, and Test). One thing to note is that Test.class shows up in the root destination directory (above a.b.c) because Test.java is missing the package statement. Perhaps, as mentioned earlier in the thread, the missing package statement is causing the problem with your compiler.
I compiled them with ant using the following build.xml code:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="compile" name="PackageTest">
<property name="build.dir" location="build"/>
<property name="dist.dir" location="dist"/>
<target name="init">
<mkdir dir="${build.dir}/classes"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="compile"
depends="init"
description="Compile Source Code">
<javac srcdir="."
destdir="${build.dir}/classes"/>
</target>
</project>
Similar Messages
-
I have connected my time capsule to motorola SG6580 modem via ethernet. I have a wireless network on the motorola and a wireless network from the time capsule. I get duplicate IPs error messages (no connection) sometimes when trying to connect devices to the wireless network. How do I fix? Sometimes devices cannot connect to the network because of conflicting IPs. I look on the Motorola and every device has a unique IP assigned but occasionally a device has taken the IP of another device. I have been writing down all the devices and the IPs they have been using. It happens more with PCs than Macs, ipads or iPhones.
If the Time Capsule is set up correctly in bridge mode, then it is the responsibility of the Motorola modem/router to provide the correct IP address assignments for all devices on the network.
Check to insure that the Time Capsule is correctly set up to operate in bridge mode as follows:
On your Mac, open AirPort Utility
Finder > Applications > Utilities > AirPort Utility
Click on the Time Capsule icon, then click Edit in the smaller window that appears
Click the Network tab at the top of the next window
Insure that the setting for Router Mode is configured to read "Off (Bridge Mode)"
Once you have confirmed that the Time Capsule is configured correctly, everything else is the responsibility of the Motorola modem/router as far as network routing and IP address assignments for devices.
If you continue to have IP address issues, then you should contact the Internet Service Provider (ISP) that provided the Motorola device to you and ask them to fix the issue. -
I get an error message when I boot up Livetype:
An unexpected error occured. (*class error for 'ProSystemStore;' class not loaded)
When I hit continue on the error message Livetype opens but when I select "New" under File the app quits. Any ideas other than reloading the app?
thanks,
Rob
G5 Mac Mac OS X (10.4.5)sorry, I can't duplicate your duplicative post. the error appears ot be a unix command or a Java thingy but I cannot find any such item on my system. I can finds tons of "class" files and several with "pros" in the filoename but none with "prosystem"
Hope you get better advice.
bogiesan -
"method not found in class " error message !
Dear People,
I have an error message that says:
"Clerk.java": Error #: 300 : method doTransaction(stan_ch15p622.Transaction) not found in class stan_ch15p622.Bank at line 36, column 12
below is the Clerk class of the program.
doTransaction() is defined below the constructor and is called at the
bottom of the class.
Thank you in advance
Stan
package stan_From_Ivor_Horton_ch15p622;
public class Clerk implements Runnable
private Bank theBank; // the employer. who the clerk works for
private Transaction inTray; //holds a transaction
public Clerk(Bank theBank)
this.theBank = theBank;
inTray = null; // no transaction initially
//receive a transaction
public void doTransaction(Transaction transaction)
inTray = transaction;
//The working clerk...
public void run()
while(true) // no transaction waiting ?
while(inTray == null)
try
Thread.sleep(150); // then take a break
catch(InterruptedException e)
System.out.println(e);
theBank.doTransaction(inTray);
inTray = null;
//you can check whether a clerk is busy by calling the isBusy() member
// it returns true if the transaction is strill in progress
public boolean isBusy()
return inTray != null;
}Dear Hambone3,
Due to your help I was able to correct my error. I mispelled the
method in the Bank class. I wrote "toTransaction" instead of
"doTransaction".I have alwyas had a hard time interrpreting the
error messages literally because many times I don't see the
connection between the message and the error. Cold water over
the brain is sometimes what I need.
God bless you.
Stan -
SNMP: Zone: Duplicate member error message
hello
customer trying to close zone under FM
and received following error message
any advice welcomed i didnt find any reference in documentation
JYP
SNMP: Zone: Duplicate member - RWSE-02A ZoneAliasList .1401.7Sounds like the message is complaining about a zone with a duplicate member in it. You may want to open a command line session to each of the MDS and see if you can locate and delete any duplicate zone members. You should check all the MDS switches in the VSAN, because the duplicate member could be in any one of them.
Hope this helps,
Mike -
Cannot lauch project, class error messages
The project was originally configured in LookoutDirect, then converted to Lookout 6.2.
One one computer I have a seperate Runtime and Development packages. This computer has been working satisfactoraly for two months.
Insatlled second runtime software on computer two, but cannot launch project because of class errors.
Can I copy the entire National Instrument folder from one computer to the other to correct this.
thanks
John Peterson
Solved!
Go to Solution.Problem solved
Believe drivers are DSComm4.cbx and Meter4.cbx, but don't bother moving them. Tried every conceivable location.
You must INSTALL the driver on both computers.Driver from Automation Direct (PC-DL-PLUS LOOKOUT DIRECT PLUS DRIVER OBJECT SFTWRE)
From the responses I think their is more than one with the problem.
Also make sure the tages are not pointing to the computer name. Tag path should start with "..\" or "..\..\" (test on yours) to work on both computers. Computer name appears depending on how you drill down to the PLC address. This doesn't stop the project, just gets rid of the red X's on the second computer.
Thanks for your responses
John Peterson -
RH11 gives a duplicate file error message converting from RH9
My project has an empty file which cannot be deleted but was ignored by RH9. In converting to RH11 I get the following message: "Error - node */Views/<folder name>/<folder name>/SBLCRVAL.htm already exists." However, there is no other file by that name in the project. There is a similar one which I renamed and everything works fine in RH9, but I cannot convert to RH11.
Hi there
I think I'd save a copy of the offending file in a safe place, then delete it from the project. After the upgrade completes, then import it back into the project.
Cheers... Rick -
Duplicate error message when doing validation
hi am geting two same error when validation,i what to display only one error message
am in jdeveloper 11.1.1.6.0,am geting duplicate validation error message
this is how am doing validation
<af:inputText value="#{bindings.Organisationname.inputValue}"
simple="true"
columns="20"
maximumLength="#{bindings.Organisationname.hints.precision}"
shortDesc="#{bindings.Organisationname.hints.tooltip}"
id="it1" autoSubmit="true" required="true"
validator="#{pageFlowScope.orgvalidation.chkOrgName}"
label="Organisation Name">
<f:validator binding="#{bindings.Organisationname.validator}"/>
</af:inputText>
public String checkName(String orgname){
ResultSet rs;
Row curPerson;
String value= null;
OrgAppModuleImpl am =(OrgAppModuleImpl)ADFUtils.getApplicationModuleForDataControl("OrgAppModuleDataControl");
try {
System.out.println("valueadded "+orgname.toUpperCase());
value =am.findbyOrgname(orgname.toUpperCase().trim());
System.out.println("valueadded "+value);
catch (Exception e) {
e.printStackTrace();
return value;
public void chkOrgName(FacesContext facesContext, UIComponent uIComponent,
Object object) {
// Add event code here...
String value =(String)object;
String evalue= checkName(value);
if( evalue == null){
}else{
FacesMessage message = new FacesMessage();
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setSummary("Organisation Name already exists.");
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage("esecurity", message);
throw new ValidatorException(message);yes i what two diffirent validation which is required=true and checking for duplication this is not what am talking about,what am talking about is the two message for duplicate validation for checking duplicate,am geting this message twice in the error message
public void chkOrgName(FacesContext facesContext, UIComponent uIComponent,
Object object) {
// Add event code here...
String value =(String)object;
String evalue= checkName(value);
if( evalue == null){
}else{
FacesMessage message = new FacesMessage();
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setSummary("Organisation Name already exists.");
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage("esecurity", message);
throw new ValidatorException(message); -
My iPod Classic won't sync--I keep getting error messages.
I have an iPod Classic (Late 2009) that's about a year and a half old. It just started refusing to sync with iTunes. I have a PC, and when I plug the iPod in, the computer wants to scan and fix the iPod. Whether I let it or not--I've done it both ways, multiple times--when I open iTunes, iTunes says I need to restore my iPod. It restores without glitching. But when I try to re-sync my library, I get 200-400 songs in and get an error message that a specific song can't be synced because of "error [numerical error]." I've seen "Error -50" a lot, but not always. It doesn't always get stuck on the same song, artist, or album--just somewhere in the B's, something goes wrong. At the beginning, I was seeing a "duplicate file" error message, but I haven't seen it the last 5-7 times I've gone through the restore-resync process.
I've tried manually managing the content, but the same thing happens. If it doesn't get stuck on a song, it'll say "Finishing Sync" for ages--until I have to force-quit iTunes and manually eject the iPod.
I have reinstalled iTunes--not 100%, but using their "find and replace faulty parts" option. I have an iPhone, and it syncs with no problem, and I my iTunes library itself is functioning totally normally. However, iTunes freezes a lot when I'm trying to fix this problem with my iPod, including when I first plug it in. I've had to force-quit iTunes multiple times because of this.
This all started because my iPod was skipping from about 10 seconds into one song to the next in the playlist. I figured something was wonky with the last sync, so I went to restore my iPod. When I plugged it in, I noticed that there was a software update, so I did that--I can't remember if I restored, then did the update, or the other way around. But nothing has worked since then.
It must be a problem with the iPod itself that the restore just isn't erasing, but I'm not sure where that leaves me. Help?This could be an indication or a damaged or dying hard drive. I would recommend doing a disk diagnostic on the iPod's HD using the instructions given by turingtest2 in this older thread. He also covers what the resulting numbers indicate.
https://discussions.apple.com/thread/3784647?start=0&tstart=0
B-rock -
I'm getting a duplicate class error and cannot find the reason for it.
the class source is declared like this: (names changed for simplicity)
package a.b.c.MyClass;
public class MyClass { /* code here */ }
when I try to compile I get:
[javac] D:\Deployments\src\MyClass.java:6: duplicate c
lass: a.b.c.MyClass
[javac] public class MyClass {
[javac] ^
what gives? There is only one copy of this class physically, and no other file tries to declare the same class name under a different filenameThe only thing I can thing of that might cause a problem is that this MyClass.java file is right under the root directory where I directed the compiler to run, it is not physically located in subfolders to match the package name, i.e. : it's at D:\Deployments\src\MyClass.java and not D:\Deployments\src\a\b\c\MyClass.java
but running a quick separate test on another java file it seems it doesnt make a difference? -
Cannot insert duplicate key row in object Error Message
Morning All,
I noticed today that the DW has not been updated with some of my CI's based off my custom class.
The event log is showing these error messages.
An error countered while attempting to execute ETL Module:
ETL process type: Transform
Batch ID: 5601
Module name: TransformPeripheralDim
Message: ErrorNumber="2601" Message="Cannot insert duplicate key row in object 'dbo.PeripheralDim' with unique index 'UniqueIndex'." Severity="14" State="1" ProcedureName="TransformPeripheralDimProc" LineNumber="163" Task="Inserting into Dimension"
Stack: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at Microsoft.SystemCenter.Warehouse.Utility.SqlHelper.ExecuteReader(SqlConnection sqlCon, CommandType cmdType, String cmdText, SqlParameter[] parameters)
at Microsoft.SystemCenter.Warehouse.Etl.StoredProcedure.Execute(IXPathNavigable config, Watermark wm, DomainUser sourceConnectionUser, DomainUser destinationConnectionUser)
at Microsoft.SystemCenter.Warehouse.Etl.TransformModule.Execute(IXPathNavigable config, Watermark wm, DomainUser sourceConnectionUser, DomainUser destinationConnectionUser)
at Microsoft.SystemCenter.Etl.ETLModule.OnDataItem(DataItemBase dataItem, DataItemAcknowledgementCallback acknowledgedCallback, Object acknowledgedState, DataItemProcessingCompleteCallback completionCallback, Object completionState)
ETL Module Execution failed:
ETL process type: Transform
Batch ID: 5601
Module name: TransformPeripheralDim
Message: ErrorNumber="2601" Message="Cannot insert duplicate key row in object 'dbo.PeripheralDim' with unique index 'UniqueIndex'." Severity="14" State="1" ProcedureName="TransformPeripheralDimProc" LineNumber="163" Task="Inserting into Dimension"
Stack: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at Microsoft.SystemCenter.Warehouse.Utility.SqlHelper.ExecuteReader(SqlConnection sqlCon, CommandType cmdType, String cmdText, SqlParameter[] parameters)
at Microsoft.SystemCenter.Warehouse.Etl.StoredProcedure.Execute(IXPathNavigable config, Watermark wm, DomainUser sourceConnectionUser, DomainUser destinationConnectionUser)
at Microsoft.SystemCenter.Warehouse.Etl.TransformModule.Execute(IXPathNavigable config, Watermark wm, DomainUser sourceConnectionUser, DomainUser destinationConnectionUser)
at Microsoft.SystemCenter.Etl.ETLModule.OnDataItem(DataItemBase dataItem, DataItemAcknowledgementCallback acknowledgedCallback, Object acknowledgedState, DataItemProcessingCompleteCallback completionCallback, Object completionState)
It was working fine so I'm not sure what's caused it to stop or where I can start looking to see what's causing it.
Any ideas?
Cheers,
SB
My System Center BlogJust in case it helps, this is the MP I'm using to bring the data across to the DW.
If I removed the MP from Service Manager, would that drop the tables in the DW and allow me to start again?
<ManagementPack
ContentReadable="true"
SchemaVersion="1.1"
OriginalSchemaVersion="1.1">
<Manifest>
<Identity>
<ID>AssetManagementReports</ID>
<Version>1.0.0.6</Version>
</Identity>
<Name>AssetManagementReports</Name>
<References>
<Reference
Alias="AssetManagemetListsRef">
<ID>AssetManagementLists</ID>
<Version>1.0.1.1</Version>
<PublicKeyToken>0a39b272096917b0</PublicKeyToken>
</Reference>
<Reference
Alias="AssetManagementMP">
<ID>AssetManagement</ID>
<Version>1.0.0.21</Version>
<PublicKeyToken>0a39b272096917b0</PublicKeyToken>
</Reference>
<Reference
Alias="DWBase">
<ID>Microsoft.SystemCenter.Datawarehouse.Base</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference
Alias="System">
<ID>System.Library</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
</References>
</Manifest>
<Warehouse>
<Outriggers>
<Outrigger
ID="EquipmentTypeList"
Accessibility="Public">
<Attribute
ID="EquipmentType"
PropertyPath="$Context/Property[Type='AssetManagementMP!AssetManagementBaseClass']/EquipmentType$"/>
</Outrigger>
<Outrigger
ID="ManufacturerList"
Accessibility="Public">
<Attribute
ID="Manufacturer"
PropertyPath="$Context/Property[Type='AssetManagementMP!AssetManagementBaseClass']/Manufacturer$"/>
</Outrigger>
<Outrigger
ID="ModelList"
Accessibility="Public">
<Attribute
ID="Model"
PropertyPath="$Context/Property[Type='AssetManagementMP!AssetManagementBaseClass']/Model$"/>
</Outrigger>
<Outrigger
ID="SupplierList"
Accessibility="Public">
<Attribute
ID="Supplier"
PropertyPath="$Context/Property[Type='AssetManagementMP!AssetManagementBaseClass']/Supplier$"/>
</Outrigger>
<Outrigger
ID="DirectorateList"
Accessibility="Public">
<Attribute
ID="Directorate"
PropertyPath="$Context/Property[Type='AssetManagementMP!AssetManagementBaseClass']/Directorate$"/>
</Outrigger>
<Outrigger
ID="DepartmentList"
Accessibility="Public">
<Attribute
ID="Department"
PropertyPath="$Context/Property[Type='AssetManagementMP!AssetManagementBaseClass']/Department$"/>
</Outrigger>
<Outrigger
ID="SectionList"
Accessibility="Public">
<Attribute
ID="Section"
PropertyPath="$Context/Property[Type='AssetManagementMP!AssetManagementBaseClass']/Section$"/>
</Outrigger>
<Outrigger
ID="LocationList"
Accessibility="Public">
<Attribute
ID="Location"
PropertyPath="$Context/Property[Type='AssetManagementMP!AssetManagementBaseClass']/Location$"/>
</Outrigger>
<Outrigger
ID="MobileTariffList"
Accessibility="Public">
<Attribute
ID="MobileTariff"
PropertyPath="$Context/Property[Type='AssetManagementMP!MobilePhoneNumberAsset']/MobileTariff$"/>
</Outrigger>
</Outriggers>
<Dimensions>
<Dimension
ID="PeripheralDim"
Accessibility="Public"
InferredDimension="true"
Target="AssetManagementMP!Peripheral"
HierarchySupport="IncludeDerivedClassProperties"
Reconcile="true"/>
<Dimension
ID="MobilePhonesDim"
Accessibility="Public"
InferredDimension="true"
Target="AssetManagementMP!MobilePhones"
HierarchySupport="IncludeDerivedClassProperties"
Reconcile="true"/>
<Dimension
ID="MobileSIMCardAssetDim"
Accessibility="Public"
InferredDimension="true"
Target="AssetManagementMP!MobileSIMCardAsset"
HierarchySupport="IncludeDerivedClassProperties"
Reconcile="true"/>
<Dimension
ID="MobilePhoneNumberAssetDim"
Accessibility="Public"
InferredDimension="true"
Target="AssetManagementMP!MobilePhoneNumberAsset"
HierarchySupport="IncludeDerivedClassProperties"
Reconcile="true"/>
<Dimension
ID="RemoteAccessTokenAssetDim"
Accessibility="Public"
InferredDimension="true"
Target="AssetManagementMP!RemoteAccessTokenAsset"
HierarchySupport="IncludeDerivedClassProperties"
Reconcile="true"/>
<Dimension
ID="CiscoIPTelephonyAssetDim"
Accessibility="Public"
InferredDimension="true"
Target="AssetManagementMP!CiscoIPTelephonyAsset"
HierarchySupport="IncludeDerivedClassProperties"
Reconcile="true"/>
<Dimension
ID="NetworkInfrastructureAssetDim"
Accessibility="Public"
InferredDimension="true"
Target="AssetManagementMP!NetworkInfrastructureAsset"
HierarchySupport="IncludeDerivedClassProperties"
Reconcile="true"/>
<Dimension
ID="ServerInfrastructureAssetDim"
Accessibility="Public"
InferredDimension="true"
Target="AssetManagementMP!ServerInfrastructureAsset"
HierarchySupport="IncludeDerivedClassProperties"
Reconcile="true"/>
</Dimensions>
<Facts>
<RelationshipFact
ID="MobiletoSIMCardFact"
Accessibility="Public"
Domain="DWBase!Domain.ConfigurationManagement"
TimeGrain="Daily"
SourceType="AssetManagementMP!MobilePhones"
SourceDimension="MobilePhonesDim">
<Relationships
RelationshipType="AssetManagementMP!MobiletoSIMCard"
TargetDimension="MobileSIMCardAssetDim"/>
</RelationshipFact>
<RelationshipFact
ID="MobiletoPhoneNumberFact"
Accessibility="Public"
Domain="DWBase!Domain.ConfigurationManagement"
TimeGrain="Daily"
SourceType="AssetManagementMP!MobilePhones"
SourceDimension="MobilePhonesDim">
<Relationships
RelationshipType="AssetManagementMP!MobiletoPhoneNumber"
TargetDimension="MobilePhoneNumberAssetDim"/>
</RelationshipFact>
<RelationshipFact
ID="MobilePhoneNumberToSIMCardFact"
Accessibility="Public"
Domain="DWBase!Domain.ConfigurationManagement"
TimeGrain="Daily"
SourceType="AssetManagementMP!MobilePhoneNumberAsset"
SourceDimension="MobilePhoneNumberAssetDim">
<Relationships
RelationshipType="AssetManagementMP!MobilePhoneNumberToSIMCard"
TargetDimension="MobileSIMCardAssetDim"/>
</RelationshipFact>
<RelationshipFact
ID="PeripheralOwnedByUserFact"
Accessibility="Public"
Domain="DWBase!Domain.ConfigurationManagement"
TimeGrain="Daily"
SourceType="AssetManagementMP!Peripheral"
SourceDimension="PeripheralDim">
<Relationships
RelationshipType="System!System.ConfigItemOwnedByUser"
TargetDimension="DWBase!UserDim"/>
</RelationshipFact>
</Facts>
</Warehouse>
<LanguagePacks>
<LanguagePack
ID="ENG"
IsDefault="true">
<DisplayStrings>
<DisplayString
ElementID="AssetManagementReports">
<Name>Asset
Management Reports</Name>
<Description>This
management pack adds an Asset Management dimension to the Data Warehouse and other items related to reporting.</Description>
</DisplayString>
</DisplayStrings>
</LanguagePack>
<LanguagePack
ID="ENU"
IsDefault="false">
<DisplayStrings>
<DisplayString
ElementID="AssetManagementReports">
<Name>Asset
Management Reports</Name>
<Description>This
management pack adds an Asset Management dimension to the Data Warehouse and other items related to reporting.</Description>
</DisplayString>
</DisplayStrings>
</LanguagePack>
</LanguagePacks>
</ManagementPack>
My System Center Blog -
"Class Circle not found in TryBouncingBalls" error message. Help !
Dear People,
I have an error message :
"TryBouncingBalls.java": Error : class Circle not found in class stan_bluej_ch5_p135.TryBouncingBalls at line 67, "
Circle circle = new Circle(xPos + 130, 30);
below are the classes TryBouncingBalls, BouncingBall, BallDemo, Canvas
Thank you in advance
Stan
package stan_bluej_ch5_p135;
import java.awt.*;
import java.awt.geom.*;
public class TryBouncingBalls
public static void main(String[] args)
Canvas myCanvas = new Canvas("Creativity at its best");
myCanvas.setVisible(true);
BouncingBall ball = new BouncingBall(50,50,16, Color.red, 500, myCanvas);
BouncingBall ball2 = new BouncingBall(70,80,20, Color.green, 500, myCanvas);
BouncingBall ball3 = new BouncingBall(90,100,16, Color.red, 500, myCanvas);
BouncingBall ball4 = new BouncingBall(30,30,20, Color.green, 500, myCanvas);
ball.draw();
ball2.draw();
ball.draw();
ball2.draw();
// make them bounce
boolean finished = false;
while(!finished) {
myCanvas.wait(50); // small delay
ball.move();
ball2.move();
ball3.move();
ball4.move();
// stop once ball has travelled a certain distance on x axis
if(ball.getXPosition() >= 550 && ball2.getXPosition() >= 550)
finished = true;
myCanvas.setFont(new Font("helvetica", Font.BOLD, 14));
myCanvas.setForegroundColor(Color.red);
myCanvas.drawString("We are having fun, ...\n\n", 20, 30);
myCanvas.wait(1000);
myCanvas.setForegroundColor(Color.black);
myCanvas.drawString("...drawing lines...", 60, 60);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.gray);
myCanvas.drawLine(200, 20, 300, 50);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.blue);
myCanvas.drawLine(220, 100, 370, 40);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.green);
myCanvas.drawLine(290, 10, 320, 120);
myCanvas.wait(1000);
myCanvas.setForegroundColor(Color.gray);
myCanvas.drawString("...and shapes!", 110, 90);
myCanvas.setForegroundColor(Color.red);
myCanvas.drawString("to bring to focus creative ideas !", 310, 290);
// the shape to draw and move
int xPos = 10;
Rectangle rect = new Rectangle(xPos + 40, 150, 30, 20);
Rectangle rect2 = new Rectangle(xPos + 80, 120, 50, 25);
Rectangle rect3 = new Rectangle(xPos+ 1200, 180, 30, 30);
Rectangle rect4 = new Rectangle(xPos + 150, 220, 40, 15);
myCanvas.fill(rect);
myCanvas.fill(rect2);
myCanvas.fill(rect3);
myCanvas.fill(rect4);
Circle circle = new Circle(xPos + 130, 30);
// Circle circle2 = new Circle(xPos + 150, 50);
// Circle circle3 = new Circle(xPos + 170, 30);
// Circle circle4 = new Circle(xPos + 200, 40);
// myCanvas.fill(circle);
// myCanvas.fill(circle2);
// myCanvas.fill(circle3);
// myCanvas.fill(circle4);
// move the rectangle and circles across the screen
for(int i = 0; i < 200; i ++) {
myCanvas.fill(rect);
myCanvas.fill(rect2);
myCanvas.fill(rect3);
myCanvas.fill(rect4);
myCanvas.wait(10);
myCanvas.erase(rect);
myCanvas.erase(rect2);
myCanvas.erase(rect3);
myCanvas.erase(rect4);
xPos++;
rect.setLocation(xPos, 150);
rect2.setLocation(xPos, 120);
rect3.setLocation(xPos, 180);
rect4.setLocation(xPos, 220);
// at the end of the move, draw once more so that it remains visible
myCanvas.fill(rect);
myCanvas.fill(rect2);
myCanvas.fill(rect3);
myCanvas.fill(rect4);
package stan_bluej_ch5_p135;
import java.awt.*;
import java.awt.geom.*;
* Class BouncingBall - a graphical ball that observes the effect of gravity. The ball
* has the ability to move. Details of movement are determined by the ball itself. It
* will fall downwards, accelerating with time due to the effect of gravity, and bounce
* upward again when hitting the ground.
* This movement can be initiated by repeated calls to the "move" method.
* @author Bruce Quig
* @author Michael Kolling (mik)
* @author David J. Barnes
* @version 1.1 (23-Jan-2002)
public class BouncingBall
private static final int gravity = 3; // effect of gravity
private int ballDegradation = 2;
private Ellipse2D.Double circle;
private Color color;
private int diameter;
private int xPosition;
private int yPosition;
private final int groundPosition; // y position of ground
private Canvas canvas;
private int ySpeed = 1; // initial downward speed
* Constructor for objects of class BouncingBall
* @param xPos the horizontal coordinate of the ball
* @param yPos the vertical coordinate of the ball
* @param ballDiameter the diameter (in pixels) of the ball
* @param ballColor the color of the ball
* @param groundPos the position of the ground (where the wall will bounce)
* @param drawingCanvas the canvas to draw this ball on
public BouncingBall(int xPos, int yPos, int ballDiameter, Color ballColor,
int groundPos, Canvas drawingCanvas)
xPosition = xPos;
yPosition = yPos;
color = ballColor;
diameter = ballDiameter;
groundPosition = groundPos;
canvas = drawingCanvas;
* Draw this ball at its current position onto the canvas.
public void draw()
canvas.setForegroundColor(color);
canvas.fillCircle(xPosition, yPosition, diameter);
* Erase this ball at its current position.
public void erase()
canvas.eraseCircle(xPosition, yPosition, diameter);
* Move this ball according to its position and speed and redraw.
public void move()
// remove from canvas at the current position
erase();
// compute new position
ySpeed += gravity;
yPosition += ySpeed;
xPosition +=2;
// check if it has hit the ground
if(yPosition >= (groundPosition - diameter) && ySpeed > 0) {
yPosition = (int)(groundPosition - diameter);
ySpeed = -ySpeed + ballDegradation;
// draw again at new position
draw();
* return the horizontal position of this ball
public int getXPosition()
return xPosition;
* return the vertical position of this ball
public int getYPosition()
return yPosition;
package stan_bluej_ch5_p135;
import java.awt.*;
import java.awt.geom.*;
* Class BallDemo - provides two short demonstrations showing how to use the
* Canvas class.
* @author Michael Kolling and David J. Barnes
* @version 1.0 (23-Jan-2002)
public class BallDemo
private Canvas myCanvas;
* Create a BallDemo object. Creates a fresh canvas and makes it visible.
public BallDemo()
myCanvas = new Canvas("Ball Demo", 600, 500);
myCanvas.setVisible(true);
* This method demonstrates some of the drawing operations that are
* available on a Canvas object.
public void drawDemo()
myCanvas.setFont(new Font("helvetica", Font.BOLD, 14));
myCanvas.setForegroundColor(Color.red);
myCanvas.drawString("We can draw text, ...", 20, 30);
myCanvas.wait(1000);
myCanvas.setForegroundColor(Color.black);
myCanvas.drawString("...draw lines...", 60, 60);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.gray);
myCanvas.drawLine(200, 20, 300, 50);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.blue);
myCanvas.drawLine(220, 100, 370, 40);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.green);
myCanvas.drawLine(290, 10, 320, 120);
myCanvas.wait(1000);
myCanvas.setForegroundColor(Color.gray);
myCanvas.drawString("...and shapes!", 110, 90);
myCanvas.setForegroundColor(Color.red);
// the shape to draw and move
int xPos = 10;
Rectangle rect = new Rectangle(xPos, 150, 30, 20);
// move the rectangle across the screen
for(int i = 0; i < 200; i ++) {
myCanvas.fill(rect);
myCanvas.wait(10);
myCanvas.erase(rect);
xPos++;
rect.setLocation(xPos, 150);
// at the end of the move, draw once more so that it remains visible
myCanvas.fill(rect);
* Simulates two bouncing balls
public void bounce()
int ground = 400; // position of the ground line
myCanvas.setVisible(true);
// draw the ground
myCanvas.drawLine(50, ground, 550, ground);
// crate and show the balls
BouncingBall ball = new BouncingBall(50, 50, 16, Color.blue, ground, myCanvas);
ball.draw();
BouncingBall ball2 = new BouncingBall(70, 80, 20, Color.red, ground, myCanvas);
ball2.draw();
// make them bounce
boolean finished = false;
while(!finished) {
myCanvas.wait(50); // small delay
ball.move();
ball2.move();
// stop once ball has travelled a certain distance on x axis
if(ball.getXPosition() >= 550 && ball2.getXPosition() >= 550)
finished = true;
ball.erase();
ball2.erase();
package stan_bluej_ch5_p135;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
* Class Canvas - a class to allow for simple graphical
* drawing on a canvas.
* @author Michael Kolling (mik)
* @author Bruce Quig
* @version 1.8 (23.01.2002)
public class Canvas
private JFrame frame;
private CanvasPane canvas;
private Graphics2D graphic;
private Color backgroundColor;
private Image canvasImage;
* Create a Canvas with default height, width and background color
* (300, 300, white).
* @param title title to appear in Canvas Frame
public Canvas(String title)
this(title, 600, 600, Color.white);
* Create a Canvas with default background color (white).
* @param title title to appear in Canvas Frame
* @param width the desired width for the canvas
* @param height the desired height for the canvas
public Canvas(String title, int width, int height)
this(title, width, height, Color.white);
* Create a Canvas.
* @param title title to appear in Canvas Frame
* @param width the desired width for the canvas
* @param height the desired height for the canvas
* @param bgClour the desired background color of the canvas
public Canvas(String title, int width, int height, Color bgColor)
frame = new JFrame();
canvas = new CanvasPane();
frame.setContentPane(canvas);
frame.setTitle(title);
canvas.setPreferredSize(new Dimension(width, height));
backgroundColor = bgColor;
frame.pack();
* Set the canvas visibility and brings canvas to the front of screen
* when made visible. This method can also be used to bring an already
* visible canvas to the front of other windows.
* @param visible boolean value representing the desired visibility of
* the canvas (true or false)
public void setVisible(boolean visible)
if(graphic == null) {
// first time: instantiate the offscreen image and fill it with
// the background color
Dimension size = canvas.getSize();
canvasImage = canvas.createImage(size.width, size.height);
graphic = (Graphics2D)canvasImage.getGraphics();
graphic.setColor(backgroundColor);
graphic.fillRect(0, 0, size.width, size.height);
graphic.setColor(Color.black);
frame.show();
* Provide information on visibility of the Canvas.
* @return true if canvas is visible, false otherwise
public boolean isVisible()
return frame.isVisible();
* Draw the outline of a given shape onto the canvas.
* @param shape the shape object to be drawn on the canvas
public void draw(Shape shape)
graphic.draw(shape);
canvas.repaint();
* Fill the internal dimensions of a given shape with the current
* foreground color of the canvas.
* @param shape the shape object to be filled
public void fill(Shape shape)
graphic.fill(shape);
canvas.repaint();
* Fill the internal dimensions of the given circle with the current
* foreground color of the canvas.
public void fillCircle(int xPos, int yPos, int diameter)
Ellipse2D.Double circle = new Ellipse2D.Double(xPos, yPos, diameter, diameter);
fill(circle);
* Fill the internal dimensions of the given rectangle with the current
* foreground color of the canvas. This is a convenience method. A similar
* effect can be achieved with the "fill" method.
public void fillRectangle(int xPos, int yPos, int width, int height)
fill(new Rectangle(xPos, yPos, width, height));
* Erase the whole canvas.
public void erase()
Color original = graphic.getColor();
graphic.setColor(backgroundColor);
Dimension size = canvas.getSize();
graphic.fill(new Rectangle(0, 0, size.width, size.height));
graphic.setColor(original);
canvas.repaint();
* Erase the internal dimensions of the given circle. This is a
* convenience method. A similar effect can be achieved with
* the "erase" method.
public void eraseCircle(int xPos, int yPos, int diameter)
Ellipse2D.Double circle = new Ellipse2D.Double(xPos, yPos, diameter, diameter);
erase(circle);
* Erase the internal dimensions of the given rectangle. This is a
* convenience method. A similar effect can be achieved with
* the "erase" method.
public void eraseRectangle(int xPos, int yPos, int width, int height)
erase(new Rectangle(xPos, yPos, width, height));
* Erase a given shape's interior on the screen.
* @param shape the shape object to be erased
public void erase(Shape shape)
Color original = graphic.getColor();
graphic.setColor(backgroundColor);
graphic.fill(shape); // erase by filling background color
graphic.setColor(original);
canvas.repaint();
* Erases a given shape's outline on the screen.
* @param shape the shape object to be erased
public void eraseOutline(Shape shape)
Color original = graphic.getColor();
graphic.setColor(backgroundColor);
graphic.draw(shape); // erase by drawing background color
graphic.setColor(original);
canvas.repaint();
* Draws an image onto the canvas.
* @param image the Image object to be displayed
* @param x x co-ordinate for Image placement
* @param y y co-ordinate for Image placement
* @return returns boolean value representing whether the image was
* completely loaded
public boolean drawImage(Image image, int x, int y)
boolean result = graphic.drawImage(image, x, y, null);
canvas.repaint();
return result;
* Draws a String on the Canvas.
* @param text the String to be displayed
* @param x x co-ordinate for text placement
* @param y y co-ordinate for text placement
public void drawString(String text, int x, int y)
graphic.drawString(text, x, y);
canvas.repaint();
* Erases a String on the Canvas.
* @param text the String to be displayed
* @param x x co-ordinate for text placement
* @param y y co-ordinate for text placement
public void eraseString(String text, int x, int y)
Color original = graphic.getColor();
graphic.setColor(backgroundColor);
graphic.drawString(text, x, y);
graphic.setColor(original);
canvas.repaint();
* Draws a line on the Canvas.
* @param x1 x co-ordinate of start of line
* @param y1 y co-ordinate of start of line
* @param x2 x co-ordinate of end of line
* @param y2 y co-ordinate of end of line
public void drawLine(int x1, int y1, int x2, int y2)
graphic.drawLine(x1, y1, x2, y2);
canvas.repaint();
* Sets the foreground color of the Canvas.
* @param newColor the new color for the foreground of the Canvas
public void setForegroundColor(Color blue)
graphic.setColor(Color.blue);
* Returns the current color of the foreground.
* @return the color of the foreground of the Canvas
public Color getForegroundColor()
return graphic.getColor();
* Sets the background color of the Canvas.
* @param newColor the new color for the background of the Canvas
public void setBackgroundColor(Color newColor)
backgroundColor = newColor;
graphic.setBackground(newColor);
* Returns the current color of the background
* @return the color of the background of the Canvas
public Color getBackgroundColor()
return backgroundColor;
* changes the current Font used on the Canvas
* @param newFont new font to be used for String output
public void setFont(Font newFont)
graphic.setFont(newFont);
* Returns the current font of the canvas.
* @return the font currently in use
public Font getFont()
return graphic.getFont();
* Sets the size of the canvas.
* @param width new width
* @param height new height
public void setSize(int width, int height)
canvas.setPreferredSize(new Dimension(width, height));
Image oldImage = canvasImage;
canvasImage = canvas.createImage(width, height);
graphic = (Graphics2D)canvasImage.getGraphics();
graphic.drawImage(oldImage, 0, 0, null);
frame.pack();
* Returns the size of the canvas.
* @return The current dimension of the canvas
public Dimension getSize()
return canvas.getSize();
* Waits for a specified number of milliseconds before finishing.
* This provides an easy way to specify a small delay which can be
* used when producing animations.
* @param milliseconds the number
public void wait(int milliseconds)
try
Thread.sleep(milliseconds);
catch (InterruptedException e)
// ignoring exception at the moment
* Nested class CanvasPane - the actual canvas component contained in the
* Canvas frame. This is essentially a JPanel with added capability to
* refresh the image drawn on it.
private class CanvasPane extends JPanel
public void paint(Graphics g)
g.drawImage(canvasImage, 0, 0, null);Dear Miciuli,
I found the definition for the circle in the canvas class and used it to creates circles ! Thank you for jaring my brain into thinking !
Stan
Ellipse2D.Double circle = new Ellipse2D.Double(xPos, 70, 30 , 30); -
This is the error message I get when i click to open FF after i downloaded the newest version: "ug-in object: TypeError: Components.classes[cid] is undefined" . The message is in the top left corner and not fully visible. i sent a message a few min ago so i am sending this b/c i copied the error message to help diagnose the problem.
This issue can be caused by an extension that isn't working properly.
Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Appearance/Themes).
* Don't make any changes on the Safe mode start window.
See:
* [[Troubleshooting extensions and themes]] -
When I open up Mozilla i get this error message--TypeError: Components.classes[cid] is undefined
also when i am working on my real estate web site and pull up a name i get the same messag. At the top it always says-- Java Script ApplicationThat error is caused by an incompatible/malfunctioning add-on. To identify the culprit follow the procedure in the [[troubleshooting extensions and themes]] article. One add-on that has caused this error for some is AVG safe search.
-
For weeks I have been viewing a doggy day care center via their web cam. This weekend I upgraded to Lion and have been unable to view the center. I get an error message for Java plug-in 1.6.0_29 ....webcam class not found. Any suggestions on how to fix this?
Sorry, don't know what else to suggest unless there's a URL to the problem stream that someone here can try. Otherwise we can't test it to try and determine what might be wrong.
BTW, make sure they're testing it with a Mac, not with a Windows system. If they test only with Windows, what they say is or is not working doesn't mean much.
Regards.
Maybe you are looking for
-
how would i check using an if statement, if any rows have been retured in a query. this is what I have at the minute, any ideas begin select count(*) from sys.aud$ where timestamp# < (sysdate - 7); if count(*) = 0 THEN do something else something els
-
Design flaw in overloading? Problem with visitor pattern
I have been trying some implementations of the Visitor pattern in Java and have encountered a problem with overloaded methods in Java. It seems that the caller (client) of a overloaded method decides what implementation of that method is chosen. I fi
-
Hi all, I have created the Km Document Iview which contains an image. Now the problem is image is very small and in page layout i have changed the hight property of iview. but still in preview image is not full occupying the space . some blank border
-
Where to store the DUNS number
Hi, We would like to store the DUNS number of our suppliers in the vendor master. It seems that an LFA1 extension is available specifically for storing the DUNS number and other D&B related data. I can not find any info on this. Can some one provide
-
HT4818 Is there a keystroke command to print a window in Windows 7 running on Boot Camp?
Is there a print window keystroke or key command similar to the fn/shift/f11 print screen keystroke that works in Windows 7 running on Boot Camp 4.0? Thank you.