Compiling a class calling another class
Hi,
I have a problem with running an applet.
my applet contains a thread and calls another class.
when i compile it with javac, it says "cannot resolve symbol class Compute" which is the name of the other class.
thank you for your help.
Hi friend,
How you solved this problem? can u please explain me
too...
I've an error while compiling my java file. cannot
resolve symbol : class Student.
where my two java files are...
StudentBean.java
public class StudentBean
public static void main(String args[])
Student s = new Student();
Student.java
public class Student
String id,name;
public Student(String id,String name)
this.id = id;
this.name = name;
Both are in the same folder, please help me out of it.
Thanking you,
Harshavardhan.I do not know about the symbol resolution. But you do not have a default constructor in Student which may be causing an issue with the compile.
Similar Messages
-
this is the class that calls another class called cuboid
package WindowsApplication1;
* Summary description for Cuboid.
//Import the classes to allow the use of the array, iterator and listiterator
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
public class DisplayCuboidValues
public static void main(String args[])
//Create the array list
ArrayList VolumeList = new ArrayList();
//Create the counter to loop 4 times and get 4 different volumes. Modify the counter
//if you need a different values
int Counter = 1;
//Initialize the counter to loop 4 times in order to get the 4 objects
while (Counter < 5)
Cuboid mp = new Cuboid(2, 4, 3);
//Add the values to the array
VolumeList.add(mp);
// get the volume again via accessor method(Optional)
//int Volume = mp.Volume();
//System.out.println(Volume);
//Increment the counter to obtain a new value in the array
Counter = Counter + 1;
// Retrieve iterator to the radiuslist
Iterator itr1 = VolumeList.iterator();
while (itr1.hasNext())
// call Cuboid.toString()
System.out.print(itr1.next());
System.out.println();
}this is the cuboid class
package WindowsApplication1;
* Summary description for Cuboid.
public class Cuboid
private final int length, width, height;
//1st contructor with 3 arguments
public Cuboid(int length, int width, int height)
this.length = length;
this.width = width;
this.height = height;
//2nd constructor with no arguments
//I BELIEVE THIS PUBLIC CUBOID IS THE ONE THE PROVOKES THE ERROR. BUT I CAN NOT DELETE IT BECAUSE I NEED ANOTHER PUBLIC CUBOID. SO IDK WHAT TO DO......
public Cuboid()
this.length = length;
this.width = width;
this.height = height;
public String toString() {
return "This cuboid has length x, width y, height z, and has volume of v where X=" + length + " " + "Y=" + width + " " + "Z=" + height + " " + "Volume=" + length * width * height + ". -- ";
//Method to calculate the Volume
public int Volume()
return length * width * height;
}This is what i have done. I have created a project named ths(which i do not use it at all). Then, i created one file called DisplayCuboidValues under ths. Then i created the file Cuboid under ths too. But it gives me errors. like this one:
init:
deps-jar:
Created dir: C:\Documents and Settings\Owner\ths\build\classes
Compiling 1 source file to C:\Documents and Settings\Owner\ths\build\classes
C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:25: variable length might not have been initialized
this.length = length;
*^*
C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:26: variable width might not have been initialized
this.width = width;
*^*
C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:27: variable height might not have been initialized
this.height = height;
*^*
Note: C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\DisplayCuboidValues.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
*3 errors*
BUILD FAILED (total time: 0 seconds)
Any help you can give me will be appreciated. Thanks.yeah. you are right in that. so that means that i have to get rid of it??. because i will need it. and the values assigned to them is in the first class that calls the second class look:
package WindowsApplication1;
* Summary description for Cuboid.
//Import the classes to allow the use of the array, iterator and listiterator
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
public class DisplayCuboidValues
public static void main(String args[])
//Create the array list
ArrayList VolumeList = new ArrayList();
//Create the counter to loop 4 times and get 4 different volumes. Modify the counter
//if you need a different values
int Counter = 1;
//Initialize the counter to loop 4 times in order to get the 4 objects
while (Counter < 5)
*//HERE IS WHERE I AM PROVIDING THE OTHER CLASS WITH VALUES. THEREFORE IT SHOULD SENT THOSE VALUES TO MY CLASS CUBOID AND RETRIEVE THE ANSWER TO FOLLOW THE REST OF THIS CODE.*
Cuboid mp = new Cuboid(2, 4, 3);
//Add the values to the array
VolumeList.add(mp);
// get the volume again via accessor method(Optional)
//int Volume = mp.Volume();
//System.out.println(Volume);
//Increment the counter to obtain a new value in the array
Counter = Counter + 1;
// Retrieve iterator to the radiuslist
Iterator itr1 = VolumeList.iterator();
while (itr1.hasNext())
// call Cuboid.toString()
System.out.print(itr1.next());
System.out.println();
} -
Java Class calling another class?
i have a class called infix and a separate class called postfix. what i am trying to do is make the infix class create a string of postfix notation and then call the postfix class to do the computation.
i have the string all ready to be passed to the postfix class for computation..my question is...how do i get it to that class?HERE ARE THE TWO CLASSES. THE POSTFIX WORKS FOR SURE AND I AM TRYING TO GET THE INFIX TO WORK. THE QUESTION IS IN THE RETURN OF THE INFIX. DONT TRY TO CORRECT THE INFIX CODE. I AM WORKING ON THAT BY MYSELF. I JUST NEED HELP ON CONNECTING THEM IF POSSIBLE. CHECK THE RETURN OF INFIX. THANKS ALOT
import java.util.*;
public class PostFix
private Set<String> ops = new HashSet<String>();
private List<String> lst = new LinkedList<String>();
private static Map<String, String> m = new HashMap<String, String>();
public List<String> getLst()
return lst;
public Map<String, String> getMap()
return m;
public PostFix( String s )
ops.add("+");
ops.add("-");
ops.add("*");
ops.add("/");
ops.add("%");
StringTokenizer sTok = new StringTokenizer(s);
while( sTok.hasMoreTokens() )
lst.add( sTok.nextToken() );
m.put( "a" , "26" );
m.put( "b" , "25" );
m.put( "c" , "24" );
m.put( "d" , "23" );
m.put( "e" , "22" );
m.put( "f" , "21" );
m.put( "g" , "20" );
m.put( "h" , "19" );
m.put( "i" , "18" );
m.put( "j" , "17" );
m.put( "k" , "16" );
m.put( "l" , "15" );
m.put( "m" , "14" );
m.put( "n" , "13" );
m.put( "o" , "12" );
m.put( "p" , "11" );
m.put( "q" , "10" );
m.put( "r" , "9" );
m.put( "s" , "8" );
m.put( "t" , "7" );
m.put( "u" , "6" );
m.put( "v" , "5" );
m.put( "w" , "4" );
m.put( "x" , "3" );
m.put( "y" , "2" );
m.put( "z" , "1" );
public int Value()
Stack<Integer>operandStack = new Stack<Integer>();
Iterator<String> iterator = lst.iterator();
String tmp;
int val1 = 0;
int val2 = 0;
int tmpInt = 0;
while( iterator.hasNext() )
tmp = iterator.next();
if( !ops.contains( tmp ) )
operandStack.push(Integer.parseInt(tmp));
else
val1 = operandStack.pop();
val2 = operandStack.pop();
Character c = new Character( tmp.charAt(0) );
switch( c )
case '+':
operandStack.push(val1 + val2);
break;
case '-':
operandStack.push(val2 - val1);
break;
case '*':
operandStack.push(val1 * val2);
break;
case '/':
operandStack.push(val2 / val1);
break;
case '%':
operandStack.push(val2 % val1);
break;
return operandStack.peek();
public int Value( Map m )
Stack<Integer> operandStack = new Stack<Integer>();
Iterator<String> iterator = lst.iterator();
String tmp;
String x;
int val1 = 0;
int val2 = 0;
int tmpInt = 0;
while( iterator.hasNext() )
tmp = iterator.next();
if( !ops.contains( tmp ) && !m.containsKey( tmp ) )
operandStack.push(Integer.parseInt(tmp));
else if ( !ops.contains(tmp) && m.containsKey(tmp) )
x = m.get(tmp).toString();
operandStack.push(Integer.parseInt(x));
else{
val1 = operandStack.pop();
val2 = operandStack.pop();
Character c = new Character( tmp.charAt(0) );
switch( c )
case '+':
operandStack.push(val1 + val2);
break;
case '-':
operandStack.push(val2 - val1);
break;
case '*':
operandStack.push(val1 * val2);
break;
case '/':
operandStack.push(val2 / val1);
break;
case '%':
operandStack.push(val2 % val1);
break;
return operandStack.peek();
and the infix is
import java.util.*;
public class InFix
PostFix pFix;
private Set<String> LowOps = new HashSet<String>();
//private Set<String> parenthesis = new HashSet<String>();
private Set<String> HighOps = new HashSet<String>();
private List<String> lst = new LinkedList<String>();
public List<String> getLst()
return lst;
public InFix( String s )
LowOps.add("+");
LowOps.add("-");
HighOps.add("*");
HighOps.add("/");
//ops.add("%");
StringTokenizer sTok = new StringTokenizer(s);
while( sTok.hasMoreTokens() )
lst.add( sTok.nextToken() );
public int Value()
Stack <String> operatorStack = new Stack<String>();
Iterator<String> iterator = lst.iterator();
String tmp = "";
String pFixStr = "";
while( iterator.hasNext() )
tmp = iterator.next();
if( tmp == "(" )
operatorStack.push(tmp);
else if( tmp == ")" )
String peektmp = operatorStack.peek();
while( peektmp != "(" )
pFixStr.concat(operatorStack.pop() );
else if( !LowOps.contains(tmp) && !HighOps.contains(tmp) )//pushes if its a number
pFixStr.concat( tmp );
else if( LowOps.contains( tmp ) )
operatorStack.push(tmp);
else if( HighOps.contains( tmp ) )
operatorStack.push(tmp);
while ( !operatorStack.empty() )
pFixStr.concat(operatorStack.pop());
System.out.println( pFixStr );
return <THIS IS WHERE I WANT TO RETURN THE COMPUTATION FROM THE POSTFIX CLASS. IS THIS CORRECT TO TRY AND RETURN A POSTFIX(PFIXSTR) OR SOMETHING LIKE THAT>
}THANKS -
UML Modeling for Class calling another class in Class Diagram and Sequence
In my application, business delegate is calling Session Facade through business interface. Session Facade is implementing business interface which includes my application business processes.
In my class diagram, I am showing business delegate, business interface and Session Facade.
What kind of relationship should be shown between
1. business delegate and business interface
2. business delegate and Sesion Facade
I am not very sure wthether relationship mentioned above are really need to show.
What should be calling sequence in sequence diagram. Do I really need to show business interface in callling sequence of sequence diagram or I can show business delegate is calling directly to Session Facade.
Thanks
SanIn my application, business delegate is calling
Session Facade through business interface. The delegate is interacting with what exactly when you say "through"?
If the delegate uses an interface then there is an association.
If it is getting an interface implementation from some other object then there is an association there.
Given the above then there is no relationship between the implementation of a interface and the delegate however.
Session Facade is implementing business interface which
includes my application business processes.The implementation would have associations to the objects that it is providing a facade for. -
I am trying to write an app to that calls another class file but i keep getting this error:
"Message.java": Error #: 300 : class Attachment not found in class Message at line 229, column 37
And this is the code where i am getting this error:
public final void addAttachment(Attachment attachment)
attachments.add(attachment);
Can someone tell me what i am doing wrong or how to fix this?
Thank you.This query brings up another point that is unrelated but of interest to me. Take a look at that method, addAttachment. All it does is call add(attachment) on an object variable that's not even lexically scoped. Is there really any benefit, any savings whatsoever in readability or ease of programming etc. in having that method? As it stands, I tend to view it as an exercise in typing. I see this a lot and so I wonder if it's just a Java thing or what.
-
Passing a parameter from one class to another class in the same package
Hi.
I am trying to pass a parameter from one class to another class with in a package.And i am Getting the variable as null every time.In the code there is two classes.
i. BugWatcherAction.java
ii.BugWatcherRefreshAction.Java.
We have implemented caching in the front-end level.But according to the business logic we need to clear the cache and again have to access the database after some actions are happened.There are another class file called BugwatcherPortletContent.java.
So, we are dealing with three java files.The database interaction is taken care by the portletContent.java file.Below I am giving the code for the perticular function in the bugwatcherPortletContent.java:
==============================================================
public Object loadContent() throws Exception {
Hashtable htStore = new Hashtable();
JetspeedRunData rundata = this.getInputData();
String pId = this.getPorletId();
PortalLogger.logDebug(" in the portlet content: "+pId);
pId1=pId;//done by sraha
htStore.put("PortletId", pId);
htStore.put("BW_HOME_URL",CommonUtil.getMessage("BW.Home.Url"));
htStore.put("BW_BUGVIEW_URL",CommonUtil.getMessage("BW.BugView.Url"));
HttpServletRequest request = rundata.getRequest();
PortalLogger.logDebug(
"BugWatcherPortletContent:: build normal context");
HttpSession session = null;
int bugProfileId = 0;
Hashtable bugProfiles = null;
Hashtable bugData = null;
boolean fetchProfiles = false;
try {
session = request.getSession(true);
// Attempting to get the profiles from the session.
//If the profiles are not present in the session, then they would have to be
// obtained from the database.
bugProfiles = (Hashtable) session.getAttribute("Profiles");
//Getting the selected bug profile id.
String bugProfileIdObj = request.getParameter("bugProfile" + pId);
// Getting the logged in user
String userId = request.getRemoteUser();
if (bugProfiles == null) {
fetchProfiles = true;
if (bugProfileIdObj == null) {
// setting the bugprofile id as -1 indicates "all profiles" is selected
bugProfileIdObj =(String) session.getAttribute("bugProfileId" + pId);
if (bugProfileIdObj == null) {
bugProfileId = -1;
else {
bugProfileId = Integer.parseInt(bugProfileIdObj);
else {
bugProfileId = Integer.parseInt(bugProfileIdObj);
session.setAttribute(
("bugProfileId" + pId),
Integer.toString(bugProfileId));
//fetching the bug list
bugData =BugWatcherAPI.getbugList(userId, bugProfileId, fetchProfiles);
PortalLogger.logDebug("BugWatcherPortletContent:: got bug data");
if (bugData != null) {
Hashtable htProfiles = (Hashtable) bugData.get("Profiles");
} else {
htStore.put("NoProfiles", "Y");
} catch (CodedPortalException e) {
htStore.put("Error", CommonUtil.getErrMessage(e.getMessage()));
PortalLogger.logException
("BugWatcherPortletContent:: CodedPortalException!!",e);
} catch (Exception e) {
PortalLogger.logException(
"BugWatcherPortletContent::Generic Exception!!",e);
htStore.put( "Error",CommonUtil.getErrMessage(ErrorConstantsI.GET_BUGLIST_FAILED));
if (fetchProfiles) {
bugProfiles = (Hashtable) bugData.get("Profiles");
session.setAttribute("Profiles", bugProfiles);
// putting the stuff in the context
htStore.put("Profiles", bugProfiles);
htStore.put("SelectedProfile", new Integer(bugProfileId));
htStore.put("bugs", (ArrayList) bugData.get("Bugs"));
return htStore;
=============================================================
And I am trying to call this function as it can capable of fetching the data from the database by "getbugProfiles".
In the new class bugWatcherRefreshAction.java I have coded a part of code which actually clears the caching.Below I am giving the required part of the code:
=============================================================
public void doPerform(RunData rundata, Context context,String str) throws Exception {
JetspeedRunData data = (JetspeedRunData) rundata;
HttpServletRequest request = null;
//PortletConfig pc = portlet.getPortletConfig();
//String userId = request.getRemoteUser();
/*String userId = ((JetspeedUser)rundata.getUser()).getUserName();//sraha on 1/4/05
String pId = request.getParameter("PortletId");
PortalLogger.logDebug("just after pId " +pId); */
//Calling the variable holding the value of portlet id from BugWatcherAction.java
//We are getting the portlet id here , through a variable from BugWatcherAction.java
/*BugWatcherPortletContent bgAct = new BugWatcherPortletContent();
String portletID = bgAct.pId1;
PortalLogger.logDebug("got the portlet ID in bugwatcherRefreshAction:---sraha"+portletID);*/
// updating the bug groups
Hashtable result = new Hashtable();
try {
request = data.getRequest();
String userId = ((JetspeedUser)data.getUser()).getUserName();//sraha on 1/4/05
//String pId = (String)request.getParameter("portletId");
//String pId = pc.getPorletId();
PortalLogger.logDebug("just after pId " +pId);
PortalLogger.logDebug("after getting the pId-----sraha");
result =BugWatcherAPI.getbugList(profileId, userId);
PortalLogger.logDebug("select the new bug groups:: select is done ");
context.put("SelectedbugGroups", profileId);
//start clearing the cache
ContentCacheContext cacheContext = getCacheContext(rundata);
PortalLogger.logDebug("listBugWatcher Caching - removing markup content - before removecontent");
// remove the markup content from cache.
PortletContentCache.removeContent(cacheContext);
PortalLogger.logDebug("listBugWatcher Caching-removing markup content - after removecontent");
//remove the backend content from cache
CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(((JetspeedUser)data.getUser()).getUserName()));
PortalLogger.logDebug("listBugWatcher Caching User: " +((JetspeedUser)data.getUser()).getUserName());
PortalLogger.logDebug("listBugWatcher Caching pId: " +pId);
if (pdata != null)
// User's data found in cache!
PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null");
pdata.removeObject(PortletCacheHelper.getUserPortletHandle(((JetspeedUser)data.getUser()).getUserName(),pId));
PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null- after removeObject");
PortalLogger.logDebug("listBugWatcher Caching -finish calling the remove content code");
//end clearing the cache
// after clearing the caching calling the data from the database taking a fn from the portletContent.java
PortalLogger.logDebug("after clearing cache---sraha");
BugWatcherPortletContent bugwatchportcont = new BugWatcherPortletContent();
Hashtable httable= new Hashtable();
httable=(Hashtable)bugwatchportcont.loadContent();
PortalLogger.logDebug("after making the type casting-----sraha");
Set storeKeySet = httable.keySet();
Iterator itr = storeKeySet.iterator();
while (itr.hasNext()) {
String paramName = (String) itr.next();
context.put(paramName, httable.get(paramName));
PortalLogger.logDebug("after calling the databs data from hashtable---sraha");
} catch (CodedPortalException e) {
PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
context.put("Error", CommonUtil.getErrMessage(e.getMessage()));
catch (Exception e) {
PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
context.put( "Error",CommonUtil.getErrMessage(ErrorConstantsI.EXCEPTION_CODE));
try {
((JetspeedRunData) data).setCustomized(null);
if (((JetspeedRunData) data).getCustomized() == null)
ActionLoader.getInstance().exec(data,"controls.EndCustomize");
catch (Exception e)
PortalLogger.logException("bugwatcherRefreshAction", e);
===============================================================
In the bugwatcher Action there is another function called PostLoadContent.java
here though i have found the portlet Id but unable to fetch that in the bugWatcherRefreshAction.java . I am also giving the code of that function under the bugWatcherAction.Java
================================================
// Get the PortletData object from intermediate store.
CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(
//rundata.getRequest().getRemoteUser()));
((JetspeedUser)rundata.getUser()).getUserName()));
pId1 = (String)portlet.getID();
PortalLogger.logDebug("in the bugwatcher action:"+pId1);
try {
Hashtable htStore = null;
// if PortletData is available in store, get current portlet's data from it.
if (pdata != null) {
htStore =(Hashtable) pdata.getObject( PortletCacheHelper.getUserPortletHandle(
((JetspeedUser)rundata.getUser()).getUserName(),portlet.getID()));
//Loop through the hashtable and put its elements in context
Set storeKeySet = htStore.keySet();
Iterator itr = storeKeySet.iterator();
while (itr.hasNext()) {
String paramName = (String) itr.next();
context.put(paramName, htStore.get(paramName));
bugwatcherRefreshAction bRefAc = new bugwatcherRefreshAction();
bRefAc.doPerform(pdata,context,pId1);
=============================================================
So this is the total scenario for the fetching the data , after clearing the cache and display that in the portal.I am unable to do that.Presently it is still fetching the data from the cache and it is not going to the database.Even the portlet Id is returning as null.
I am unable to implement that thing.
If you have any insight about this thing, that would be great .As it is very urgent a promt response will highly appreciated.Please send me any pointers or any issues for this I am unable to do that.
Please let me know as early as possible.
Thanks and regards,
Santanu Raha.Have you run it in a debugger? That will show you exactly what is happening and why.
-
Accessing a variable defined in one class from another class..
Greetings,
I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.
Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem to be working for me. Any ideas would be appreciated. Thanks,
- Jeremy
package jab.enemy
import flash.display.MovieClip;
import flash.events.Event;
import jab.enemy.MissleDisappear;
public class DieLikeThePhishes
private var _clip2:MovieClip; // player
private var _clip3:MovieClip; //phish1
private var _clip4:MovieClip; //phish2
private var _clip5:MovieClip; //phish3
private var _clip6:MovieClip; //phish4
private var _clip10:MovieClip; // background
private var _clip11:MovieClip // missle1
private var _clip12:MovieClip // missle2
private var _clip13:MovieClip // missle3
private var _clip14:MovieClip // missle4
private var _clip15:MovieClip // missle5
private var _clip16:MovieClip // missle6
private var _clip17:MovieClip // missle7
private var _clip18:MovieClip // missle8
private var _clip19:MovieClip // missle9
private var _clip20:MovieClip // missle10
private var _clip21:MovieClip // missle11
private var _clip22:MovieClip // missle12
var ay1 = 0;var ay2 = 0;var ay3 = 0;var ay4 = 0;
var vy1 = 0;var vy2 = 0;var vy3 = 0;var vy4 = 0;
var phish1BeenHit:Boolean = false;var phish2BeenHit:Boolean = false;
var phish3BeenHit:Boolean = false;var phish4BeenHit:Boolean = false;
public function DieLikeThePhishes(clip2:MovieClip,clip3:MovieClip,clip4:MovieClip,clip5:MovieClip,clip6:M ovieClip,clip10:MovieClip,clip11:MovieClip,clip12:MovieClip,clip13:MovieClip,clip14:MovieC lip,clip15:MovieClip,clip16:MovieClip,clip17:MovieClip,clip18:MovieClip,clip19:MovieClip,c lip20:MovieClip,clip21:MovieClip,clip22:MovieClip)
_clip2 = clip2;_clip3 = clip3;_clip4 = clip4;_clip5 = clip5;_clip6 = clip6;
_clip10 = clip10;_clip11 = clip11;_clip12 = clip12;_clip13 = clip13;_clip14 = clip14;
_clip15 = clip15;_clip16 = clip16;_clip17 = clip17;_clip18 = clip18;_clip19 = clip19;
_clip20 = clip20;_clip21 = clip21;_clip22= clip22;
_clip3.stage.addEventListener(Event.ENTER_FRAME, onEnterFrame)
function onEnterFrame(event:Event):void
vy1+= ay1;_clip3.y += vy1; vy2+= ay2;_clip4.y += vy2;
vy3+= ay3;_clip5.y += vy3; vy4+= ay4;_clip6.y += vy4;
if (phish1BeenHit ==false)
if(_clip3.y >620)
{_clip3.y = 620;}
if (phish2BeenHit ==false)
if(_clip4.y >620)
{_clip4.y = 620;}
if (phish3BeenHit ==false)
if(_clip5.y >620)
{_clip5.y = 620;}
if (phish4BeenHit ==false)
if(_clip6.y >620)
{_clip6.y = 620;}
if (_clip11.hitTestObject(_clip3) ||_clip12.hitTestObject(_clip3)||_clip13.hitTestObject(_clip3)||_clip14.hitTestObject(_cl ip3)||_clip15.hitTestObject(_clip3)||_clip16.hitTestObject(_clip3)||_clip17.hitTestObject( _clip3)||_clip18.hitTestObject(_clip3)||_clip19.hitTestObject(_clip3)||_clip20.hitTestObje ct(_clip3)||_clip21.hitTestObject(_clip3)||_clip22.hitTestObject(_clip3))
_clip3.scaleY = -Math.abs(_clip3.scaleY);
_clip3.alpha = 0.4;
ay1 = 3
vy1= -2;
phish1BeenHit = true;
if (_clip11.hitTestObject(_clip4) ||_clip12.hitTestObject(_clip4)||_clip13.hitTestObject(_clip4)||_clip14.hitTestObject(_cl ip4)||_clip15.hitTestObject(_clip4)||_clip16.hitTestObject(_clip4)||_clip17.hitTestObject( _clip4)||_clip18.hitTestObject(_clip4)||_clip19.hitTestObject(_clip4)||_clip20.hitTestObje ct(_clip4)||_clip21.hitTestObject(_clip4)||_clip22.hitTestObject(_clip4))
_clip4.scaleY = -Math.abs(_clip4.scaleY);
_clip4.alpha = 0.4;
ay2 = 3
vy2= -2;
phish2BeenHit = true;
if (_clip11.hitTestObject(_clip5) ||_clip12.hitTestObject(_clip5)||_clip13.hitTestObject(_clip5)||_clip14.hitTestObject(_cl ip5)||_clip15.hitTestObject(_clip5)||_clip16.hitTestObject(_clip5)||_clip17.hitTestObject( _clip5)||_clip18.hitTestObject(_clip5)||_clip19.hitTestObject(_clip5)||_clip20.hitTestObje ct(_clip5)||_clip21.hitTestObject(_clip5)||_clip22.hitTestObject(_clip5))
_clip5.scaleY = -Math.abs(_clip5.scaleY);
_clip5.alpha = 0.4;
ay3 = 3
vy3= -2;
phish3BeenHit = true;
if (_clip11.hitTestObject(_clip6) ||_clip12.hitTestObject(_clip6)||_clip13.hitTestObject(_clip6)||_clip14.hitTestObject(_cl ip6)||_clip15.hitTestObject(_clip6)||_clip16.hitTestObject(_clip6)||_clip17.hitTestObject( _clip6)||_clip18.hitTestObject(_clip6)||_clip19.hitTestObject(_clip6)||_clip20.hitTestObje ct(_clip6)||_clip21.hitTestObject(_clip6)||_clip22.hitTestObject(_clip6))
_clip6.scaleY = -Math.abs(_clip6.scaleY);
_clip6.alpha = 0.4;
ay4 = 3
vy4= -2;
phish4BeenHit = true;
if (_clip3.y > 10000)
_clip3.x = 1000 +3000*Math.random()-_clip10.x;
_clip3.y = 300;
_clip3.alpha = 1;
_clip3.scaleY = Math.abs(_clip3.scaleY);
ay1 = vy1 = 0;
phish1BeenHit = false;
if (_clip4.y > 10000)
_clip4.x = 1000 +3000*Math.random()-_clip10.x;
_clip4.y = 300;
_clip4.alpha = 1;
_clip4.scaleY = Math.abs(_clip4.scaleY);
ay2 = vy2 = 0;
phish2BeenHit = false;
if (_clip5.y > 10000)
_clip5.x = 1000 +3000*Math.random()-_clip10.x;
_clip5.y = 300;
_clip5.alpha = 1;
_clip5.scaleY = Math.abs(_clip5.scaleY);
ay3 = vy3 = 0;
phish3BeenHit = false;
if (_clip6.y > 10000)
_clip6.x = 1000 +3000*Math.random()-_clip10.x;
_clip6.y = 300;
_clip6.alpha = 1;
_clip6.scaleY = Math.abs(_clip6.scaleY);
ay4 = vy4 = 0;
phish4BeenHit = false;
var missleDisappear1 = new MissleDisappear(_clip11,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear2 = new MissleDisappear(_clip12,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear3 = new MissleDisappear(_clip13,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear4 = new MissleDisappear(_clip14,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear5 = new MissleDisappear(_clip15,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear6 = new MissleDisappear(_clip16,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear7 = new MissleDisappear(_clip17,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear8 = new MissleDisappear(_clip18,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear9 = new MissleDisappear(_clip19,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear10 = new MissleDisappear(_clip20,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear11 = new MissleDisappear(_clip21,_clip3,_clip4,_clip5,_clip6,_clip10);
var missleDisappear12 = new MissleDisappear(_clip22,_clip3,_clip4,_clip5,_clip6,_clip10);I would approach it in much the same way as you would in java, by making getters and setters for all of your class variables.
Getters being for returning the values, Setters being for setting them.
So you would make a get function for the variable you want to access ala:
function get1PhishBeenHit():boolean {
return this.phish1BeenHit;
Then to access the value of that variable from outwith the class:
var result:boolean = ClassInstanceName.get1PhishBeenHit(); -
How to kill one class from another class
I need to dipose one class from another class.
So that first i have to find what are all threads running in that class and then to kill them
Assist me.Subbu_Srinivasan wrote:
I am explaining you in clear way
No you haven't been.
>
In my application i am handling many JInternalFrame.Simultaneously i am running working on more than one frame.
Due to some poor performance of some thread in one JInternalFrame,the thread is keeps on running .
i could not able to proceed further on that screen.
So i have to kill that JInternalFrame.Yoinks.
To be begin with your problem sounds like you are doing everything in one thread. So stop doing that. Second when you get it split up and if a task is taking too much time then interrupt it. No kill. Interrupt. This means the worker thread needs to check sometimes if it has been interrupted. -
How Do I Run A Class From Another Class?
Hiya everyone, id like to know how to run a class from another class.
Ive got a Login class which extends a JFrame and a Personnel class which also extends a JFrame. When i press the login button (in Login class), ive got it to decide if password/login are acceptable and if they are, I want the Login class to close then run the Personnel class.
Im just after the code which says to close this class and run the Personnel class. How do i do that?
Ive researched this but couldnt get an understandable answer!
Help would be much appreciated, Ant...This is the Login Class:
public class MainMenu extends javax.swing.JFrame {
Statement statement = null;
int currentRecord;
ResultSet rs = null;
String name = null, job = null, mission = null, login = null, password = null;
String loginVal;
String passwordVal;
/** Creates new form MainMenu */
public MainMenu() {
initComponents();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String filename = System.getProperty("user.dir") + "/src/Personnel.mdb";
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + filename;
Connection conn = DriverManager.getConnection( database , "","");
statement = conn.createStatement();
System.out.println("Connected...ok");
} catch (Exception e) {
System.err.println("Got a connection Problem!");
System.err.println(e.getMessage());
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {
loginVal = txtLogin.getText();
passwordVal = txtPassword.getText();
String name = null, job = null, mission = null, login = null, password = null;
try{
rs = statement.executeQuery("SELECT Login,Password FROM Personnel WHERE Login = '" + loginVal + "' ");
System.out.println("TRYING SELECT CLAUSE");
if(rs.next()){
System.out.println("THERE IS A NEXT RECORD");
login = rs.getString(1);
password = rs.getString(2);
System.out.println("GOT THE NEXT RECORD");
System.out.println(login + password);
System.out.println("Query Complete");
}catch(Exception s){
//s.printStackTrace();
System.out.println("NO RECORDS EXIST FOR THIS LOGIN ID");
if(passwordVal.equals(password)){
System.out.println("Access Granted"); //CLOSE MAIN AND RUN CONTROL CLASS
} else{
System.out.println("Access Denied"); //RE-RUN CLASS
} -
Cannot resolve symbol error when compiling a class that calls another class
I've read all the other messages that include "cannot resolve symbol", but no luck. I've got a small app - 3 classes all in the same package. BlackjackDAO and Player compile OK, but BlackjackServlet throws the "cannot resolve symbol" (please see pertinent code below)...
I've tried lots: ant and javac compiling, upgrading my version of tomcat, upgrading my version of jdk/jre, making sure my servlet.jar is being seen by the compiler (at least as far as I can see from the -verbose feedback)...any help would be GREAT! Thanks in advance...
classes: BlackjackServlet, BlackjackDAO, Player
package: myblackjackpackage
tomcat version: 4.1.1.8
jdk version: j2sdk 1.4.0
ant version: 1.4.1
I get the same error message from Ant and Javac...
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
compile error:
BlackjackServlet.java:55: cannot resolve symbol
symbol: method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet.http.Http
ServletResponse)
location: class myblackjackpackage.BlackjackServlet
addPlayer(request, response);
^
My code is:
package myblackjackpackage;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.lang.*;
/** controller servlet in a web based blackjack game application @author Ethan Harlow */
public class BlackjackServlet extends HttpServlet {
private BlackjackDAO theBlackjackDAO;
public void init() throws ServletException {
String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433";
String userid = "testlogin";
String passwrd = "testpass";
try {
theBlackjackDAO = new BlackjackDAO(driver, dbUrl, userid, passwrd);
catch (IOException exc) {
System.err.println(exc.toString());
catch (ClassNotFoundException cnf) {
System.err.println(cnf.toString());
catch (SQLException seq) {
System.err.println(seq.toString());
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String command = request.getParameter("command");
if (command == null || (command.equals("stats"))) {
else if (command.equals("add")) {
try {
//the following line is caught by compiler
addPlayer(request, response);
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<p>Hi, your command was " + request.getParameter("command") + "!!!</p>");
out.println("</body>");
out.println("</html>");
catch (Exception exc) {
System.err.println(exc.toString());
else if (command.equals("play")) {
else if (command.equals("bet")) {
else if (command.equals("hit")) {
else if (command.equals("stand")) {
else if (command.equals("split")) {
else if (command.equals("double")) {
else if (command.equals("dealerdecision")) {
else if (command.equals("reinvest")) {
else if (command.equals("changebet")) {
else if (command.equals("deal")) {
package myblackjackpackage;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.lang.*;
public class BlackjackDAO {
private Connection myConn;
public BlackjackDAO(String driver, String dbUrl, String userid, String passwrd)
throws IOException, ClassNotFoundException, SQLException {
System.out.println("Loading driver: " + driver);
Class.forName(driver);
System.out.println("Connection to: " + dbUrl);
myConn = DriverManager.getConnection(dbUrl, userid, passwrd);
System.out.println("Connection successful!");
public void addPlayer(HttpServletRequest request, HttpServletResponse response)
throws IOException, SQLException {
//I've commented out all my code while debugging, so I didn't include
//any here
compiler feedback
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>javac *.java -verbose
[parsing started BlackjackDAO.java]
[parsing completed 90ms]
[parsing started BlackjackServlet.java]
[parsing completed 10ms]
[parsing started Player.java]
[parsing completed 10ms]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Object.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/Connection.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/String.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/IOException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/ClassNotFoundException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/SQLException.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletRequ
est.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServletResp
onse.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/http/HttpServlet.cla
ss)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/GenericServlet.class
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/Servlet.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletConfig.class)
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Serializable.class)]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletException.cla
ss)]
[checking myblackjackpackage.BlackjackDAO]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Throwable.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Exception.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/System.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/OutputStream.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Class.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/sql/DriverManager.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/util/Properties.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/Error.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/RuntimeException.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/lang/StringBuffer.class)]
[wrote BlackjackDAO.class]
[checking myblackjackpackage.BlackjackServlet]
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletRequest.class
BlackjackServlet.java:55: cannot resolve symbol
symbol : method addPlayer (javax.servlet.http.HttpServletRequest,javax.servlet
.http.HttpServletResponse)
location: class myblackjackpackage.BlackjackServlet
addPlayer(request, response);
^
[loading c:\tomcat4118\common\lib\servlet.jar(javax/servlet/ServletResponse.clas
s)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/PrintWriter.class)]
[loading c:\j2sdk14003\jre\lib\rt.jar(java/io/Writer.class)]
[checking myblackjackpackage.Player]
[total 580ms]
1 error
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage>
and here's the ant feedback...
C:\Tomcat4118\src\webapps\helloblackjack>ant all -verbose
Ant version 1.4.1 compiled on October 11 2001
Buildfile: build.xml
Detected Java version: 1.4 in: c:\j2sdk14003\jre
Detected OS: Windows 2000
parsing buildfile C:\Tomcat4118\src\webapps\helloblackjack\build.xml with URI =
file:C:/Tomcat4118/src/webapps/helloblackjack/build.xml
Project base dir set to: C:\Tomcat4118\src\webapps\helloblackjack
Build sequence for target `all' is [clean, prepare, compile, all]
Complete build sequence is [clean, prepare, compile, all, javadoc, deploy, dist]
clean:
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.g
if
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.g
if
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\im
ages
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\index.html
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.ht
ml
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\clas
ses\myblackjackpackage\BlackjackDAO.class
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF\classes\myblackjackpackage
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF\classes
[delete] Deleting C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.
xml
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build\WE
B-INF
[delete] Deleting directory C:\Tomcat4118\src\webapps\helloblackjack\build
prepare:
[mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build
[copy] images\a_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\images\a_s.gif doesn't exist.
[copy] images\q_s.gif added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\images\q_s.gif doesn't exist.
[copy] index.html added as C:\Tomcat4118\src\webapps\helloblackjack\build\i
ndex.html doesn't exist.
[copy] newplayer.html added as C:\Tomcat4118\src\webapps\helloblackjack\bui
ld\newplayer.html doesn't exist.
[copy] WEB-INF\web.xml added as C:\Tomcat4118\src\webapps\helloblackjack\bu
ild\WEB-INF\web.xml doesn't exist.
[copy] omitted as C:\Tomcat4118\src\webapps\helloblackjack\build is up to
date.
[copy] images added as C:\Tomcat4118\src\webapps\helloblackjack\build\image
s doesn't exist.
[copy] WEB-INF added as C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-
INF doesn't exist.
[copy] Copying 5 files to C:\Tomcat4118\src\webapps\helloblackjack\build
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\q_s.gif
to C:\Tomcat4118\src\webapps\helloblackjack\build\images\q_s.gif
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\images\a_s.gif
to C:\Tomcat4118\src\webapps\helloblackjack\build\images\a_s.gif
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\index.html to C
:\Tomcat4118\src\webapps\helloblackjack\build\index.html
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\newplayer.html
to C:\Tomcat4118\src\webapps\helloblackjack\build\newplayer.html
[copy] Copying C:\Tomcat4118\src\webapps\helloblackjack\web\WEB-INF\web.xml
to C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\web.xml
compile:
[mkdir] Created dir: C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-INF\
classes
[javac] myblackjackpackage\BlackjackDAO.class skipped - don't know how to ha
ndle it
[javac] myblackjackpackage\BlackjackDAO.java added as C:\Tomcat4118\src\weba
pps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackDAO.class d
oesn't exist.
[javac] myblackjackpackage\BlackjackServlet.java added as C:\Tomcat4118\src\
webapps\helloblackjack\build\WEB-INF\classes\myblackjackpackage\BlackjackServlet
.class doesn't exist.
[javac] myblackjackpackage\Player.java added as C:\Tomcat4118\src\webapps\he
lloblackjack\build\WEB-INF\classes\myblackjackpackage\Player.class doesn't exist
[javac] Compiling 3 source files to C:\Tomcat4118\src\webapps\helloblackjack
\build\WEB-INF\classes
[javac] Using modern compiler
[javac] Compilation args: -d C:\Tomcat4118\src\webapps\helloblackjack\build\
WEB-INF\classes -classpath
"C:\Tomcat4118\src\webapps\helloblackjack\build\WEB-I
NF\classes;
C:\tomcat4118\common\classes;
C:\tomcat4118\common\lib\activation.jar;
C:\tomcat4118\common\lib\ant.jar;
C:\tomcat4118\common\lib\commons-collections.jar;
C:\tomcat4118\common\lib\commons-dbcp.jar;
C:\tomcat4118\common\lib\commons-logging-api.jar;
C:\tomcat4118\common\lib\commons-pool.jar;
C:\tomcat4118\common\lib\jasper-compiler.jar;
C:\tomcat4118\common\lib\jasper-runtime.jar;
C:\tomcat4118\common\lib\jdbc2_0-stdext.jar;
C:\tomcat4118\common\lib\jndi.jar;
C:\tomcat4118\common\lib\jta.jar;
C:\tomcat4118\common\lib\mail.jar;
C:\tomcat4118\common\lib\mysql_uncomp.jar;
C:\tomcat4118\common\lib\naming-common.jar;
C:\tomcat4118\common\lib\naming-factory.jar;
C:\tomcat4118\common\lib\naming-resources.jar;
C:\tomcat4118\common\lib\servlet.jar;
C:\tomcat4118\common\lib\tools.jar;
C:\j2sdk14003\lib\tools.jar;
C:\tomcat4118\ant141\lib\servlet.jar;
C:\tomcat4118\ant141\lib\jaxp.jar;
C:\tomcat4118\ant141\lib\crimson.jar;
C:\tomcat4118\ant141\lib\ant.jar;
C:\Tomcat4118\src\webapps\helloblackjack;
C:\mysql\jdbc_dvr\mm.mysql.jdbc-1.2c;
C:\Program Files\SQLserverjdbcdriver\lib\msbase.jar;
C:\Program Files\SQLserverjdbcdriver\lib\msutil.jar;
C:\Program Files\SQLserverjdbcdriver\lib\mssqlserver.jar"
-sourcepath C:\Tomcat4118\src\webapps\helloblackjack\src -g -O
[javac] Files to be compiled:
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackDAO
.java
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\BlackjackSer
vlet.java
C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Player.java
[javac] C:\Tomcat4118\src\webapps\helloblackjack\src\myblackjackpackage\Blac
kjackServlet.java:55: cannot resolve symbol
[javac] symbol : method addPlayer (javax.servlet.http.HttpServletRequest,j
avax.servlet.http.HttpServletResponse)
[javac] location: class myblackjackpackage.BlackjackServlet
[javac] addPlayer(request, response);
[javac] ^
[javac] 1 error
BUILD FAILED
C:\Tomcat4118\src\webapps\helloblackjack\build.xml:212: Compile failed, messages
should have been provided.
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:559)
at org.apache.tools.ant.Task.perform(Task.java:217)
at org.apache.tools.ant.Target.execute(Target.java:184)
at org.apache.tools.ant.Target.performTasks(Target.java:202)
at org.apache.tools.ant.Project.executeTarget(Project.java:601)
at org.apache.tools.ant.Project.executeTargets(Project.java:560)
at org.apache.tools.ant.Main.runBuild(Main.java:454)
at org.apache.tools.ant.Main.start(Main.java:153)
at org.apache.tools.ant.Main.main(Main.java:176)
Total time: 1 second
C:\Tomcat4118\src\webapps\helloblackjack>yes!
early on i tried: BlackjackDAO.addPlayer(request, response);
instead of: theBlackjackDAO.addPlayer(request, response);
you rock - thanks a ton -
Calling a method within a class form another class(ViewController)
I am creating an SQL project in XCODE. I have one view. My main view controller is loading the database to a table/array. I want to add another class (with no NIB) just to handle the display of the table in a UITableView. So, I added a skeleton cocoa touch class file to my classes folder to handle this function when parameters change.
So, in my app delegate, the "applicationdidFinishLaunchingWithOptions" method loads my mainViewController and NIB. On the "viewDidLoad" method in my mainViewController, I read a URL into an SQLite database and close the database. Herein lies the problem: I want to call my new class (TableViewHandler) and pass it the array created in the mainViewController and use the array to populate the UITable.
How do I call a class from within another class (which has no NIB) to populate the table? Especially if my TableViewHandler has no "viewDidLoad", "viewDidAppear", etc.
Regads,
-KevinThis is what my exact problem.
i've created a bean (DataBean) to access the database. i'm having a servlet program (ShopBook). now to check some details over there in the database from the servlet i'm in need to use a method in the DataBean.
both ShopBook.java and DataBean.java lies in the package shoppack.
in ShopBook i tried to instantiate the object to DataBean as
DataBean db = new DataBean();
it shows the compiler error, unable to resolve symbol DataBean.
note:
first i compiled DataBean.java, it got compiled perfectly and the class file resides inside the shoppack.
when i'm trying to compile the ShopBook its telling this error.
hope i'm clear in explaining my problem. can u please help me?
thank u in advance.
regards,
Fazli -
Call(execute) a class in another class
Hi,
please I am a newbie in java and I want call and show the result of algorithm in a method of another class
the algorithm that I use is apriori algorithmhttp://www2.cs.uregina.ca/~dbd/cs831/notes/itemsets/itemset_prog1.html, that algorithm should use two files like arguments:config.txt and transa.txt when I excute this algorithm in line command the algorithm output is file called apriori-output.txt so i want excuteafter show result of this algorithm inside a class called JadeProject and and more specifically in method called setup()
so how can call and execut this algorithm
thanks in advanceHi gimbal2,
thank you for your reply,
My problem is the following:
my question is how can I execute the apriori algorithm inside the agent code (java class)
I want to build multi agent system using jade(framwork based in java language it is used to build multi agent system) my multi agent system is composed in many agents
those agents are juste java classes
My aim is to execute an algorithm(java class) in agent class
this algorithm is the data mining algorithm apriori http://www2.cs.uregina.ca/~dbd/cs831/notes/itemsets/itemset_prog1.html
the apriori algorithm use two text files :config.txt and transa.txt
i put the algorithm aprioir and the two files in the same directory and i compile the algorithm java class in line command
the output of the execution of algorithm is generating in text file called apriori-output.txt
but I am using netbeans and no line command
my question is how can I execute the apriori algorithm inside the agent code (java class)
thank you in advances -
Compiling a class from another class
is it possible to compile a class from the code in another class?
i.e I want to check whether code in a .java file will compile before I use it.
Is there any methods that I could use to do this and could anyone give me advice on HOW to use the methods suggested?
thanks in advance
davidi was looking at that but it seems to only run files, not commands
is there a way to use it with command.com or cmd.exe or something to send commands to it?
also if i used a readline on an inputstream it only returned the first line (i tried running a batch file so the only line it returned was ..> javac testscript.java but i spose if i put
@echo off
javac testscript.java
if exist testscript.class (
echo compiled correctly
) else (
echo compiled incorectly
so the first line returned would either be "compiled correctly" or the compile error, but this would be compiling it to see if it compiles so im not sure if this answers the first question anyway =p -
Instantiating an Array declared in a class from another class
Hi Guys,
I am working on a project for University and I'm stuck with this thins, which I'm sure is pretty easy when you know how...
I have a first class "Courses" in which I declare my Array, here is the code:
import java.util.*;
public class Courses
private String[][] Listing;
Courses(String[][] l)
l = Listing;
}This class compiles just fine but I have 2 problems:
1/ Can I make sure that this array will be [3][4] ?
When I try : "private String[3][4] Listing;" or "Courses(String[3][4] l)" the class doesn't compile anymore...
FYI: I want to store the followings in my array:
French Language, 250, 130, 70
Painting, 270, 140, 70
Yoga, 250, 130, 70
2/ How can I instantiate this from another class?
From a class "Booking" I want to be able to create a new array "Listing" by calling my constructor from the Courses class and populate it with the above data (course,full-time price, part-time price, Concessions price )
How do I do that?Thanks, I've modofied my code as follows:
import java.util.*;
public class Courses
private String[][] Listing = new String[3][4]; //create array 3 rows * 4 columns
Courses(String[][] l)
l = Listing;
int i;
int j;
int p;
String t;
String p1;
String getTitle(int i) //return Course Title
t=Listing[0];
return t;
int getPrice(int i, int j) //return Price (Full-Time, Part-Time, Concessions)
p1=Listing[i][j];
p=Integer.parseInt(p1);
return p;
now from my nex class Booking I want to instantiate Courses:
public class Booking
Courses c = new Courses()
}How do I actually pass the data to this...what's the syntax so that my instance will be:
c[0][0]="French Language"
c[0][1]="250"
c[0][2]="130"
c[0][3]="70"
c[1][0]="Painting"
c[1][1]="270"
c[1][2]="140"
c[1][3]="70"
c[2][0]="Yoga"
c[2][1]="250"
c[2][2]="130"
c[2][3]="70"
Thanks in advance,
Tom -
How to use class within another class?
Hi,
I have written a couple of beans, and I have classified them all as part of a "beans" package. All class files are in the same folder. One of the beans in called "ProcessTextBean.class" and it contians a method "validate_email" which validates a supplied email address, I want to call that method from another bean. I think the following line should work but compiler returns an error (Cannot resolve symbol with an arrow underneath "ProcessTextBean"):
boolean result = beans.ProcessTextBean.validate_email("[email protected]");
Any ideas what I'm doing wrong? Thanks.
Junaid.beans.ProcessTextBean
Hihi..
is you validate_email a static method ?
if not i dun think you can do it.
you can try the followingf:
ProcessTextBean ptb = new ProcessTextBean();
............. = ptb.validate_email(emailAdd);
or
.................... = new ProcessTextBean().validate_email(emailAdd)
sorry...i may be wrong.
its a long time since i touch such a wonderful language such as Java..
now my org using VBA..:(
Maybe you are looking for
-
HT4929 installing icloud on windows 7 64 bit
How can I install the icloud desktop on a Windows 7 64 bit PC?
-
Hai, I have problem in advancedTable in oaf. I don't know how to get last clicked row events in advancedTable. I construct the advancedTable using VO without EO. I want to save last modified record into database. But I can't do. T
-
How to send a report output as a FAX ?
Hallo Experts, How to send a report output as a FAX ? Suppose if I have all the data in an internal table, I will show it as a normal list OR ALV list output. In the application tool bar I should have a button, and by clicking it the output should go
-
My purchased app disappeared in App Store but instead a new version is found with the same name and developer. It's Pocket Expense, my version is 4.5.1 and it has some issue now. What should I do? Delete the old and buy the new one? What happen to al
-
Recreating my iTunes library from my iPod classic
I recently had to reinstall Windows XP on my laptop for various reasons. Obviously, in the process I wiped clean my iTunes library. I am now wary of synchronisng my iPod classic as I have a LOT of DVDs, purchased music, etc. that took a considerable