AS class file - error defining dynamic component method
In the constructor of my custom class, I have a loop set up
that creates a number of CheckBox instances based on the results of
a remoting query.
This loop works fine, and I see the new component instances
on the stage.
However, when I try to define the "click" method for each of
those checkboxes, I'm getting a compiler error:
"There is no property with the name 'click'."
I've included the CheckBox class using the import statement
at the top of my AS file (import mx.controls.CheckBox;).
Here is the block of code throwing the error:
click isn't a property but an event. If you want to respond
to that event, you have to setup a listener. Hit F1 and search for
Checkbox.click
Similar Messages
-
Hi
I set my java home to JDK 1.4 and execute my build.It is ok.
Then i try the same by setting JDK 1.5 as java home. build is ok.
But now i need to use only JDK 1.4.So i set my java home as jdk 1.4 and try to execute the build.xml
Now i got the error of class file has wrong version 49.0, should be 48.0
I understand that the class files(49.0) which are created by JDK 1.5 and i try to execute those by JDK 1.4.
But i donot knwo how to solve this.
Will anybody please help me to solve?
Thank youHi
I didnot compile java files with JDK 1.4 and 1.5 both.
First time i use JDk 1.4. for all java files
Second time i use JDk 1.5 for all java files.
Finally i should use JDK 1.4. So i come to jdk 1.4 and set java home jdk 1.4 and exucute my build.xml. Then i got the bad class file error.
Can u help me at this point?
Thank you -
Javac probleme: bad class file error
I'm new to java
I have two classes myPoint.jav and TestPoint.java, when I compile them, I error:
in the command line I type:
C:\otman\java>javac -g geometry\src\myPoint.java TestPoint.java
TestPoint.java:8: cannot access myPoint
bad class file: c:\otman\java\geometry\src\myPoint.class
class file contains wrong class: geometry.src.myPoint
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
myPoint p = new myPoint();
^
1 error
Can some one help me Thanks
//Here is the class c:\otman\java\TestPoint.java
import geometry.src.*;
Testing my class Point
public class TestPoint {
public static void main(String[] args) {
myPoint p = new myPoint();
System.out.println("thank you very much");
System.exit(0);
// And here is the class c:\otman\java\geometry\src\myPoint.java
package geometry.src;
class myPoint members and methods of a 3D point
public class myPoint {
private double m_x,m_y,m_z; // the coordinates
public double getx() {return m_x;}
public double gety() {return m_y;}
public double getz() {return m_z;}
public void setx(double x) {m_x=x;}
public void sety(double y) {m_y=y;}
public void setz(double z) {m_z=z;}
public void translate(double dx,double dy, double dz) {
m_x += dx;m_y += dy;m_z += dz;
// Constructor ------------------------------------------------------------
myPoint(double x,double y,double z) {
m_x=x;m_y=y;m_z=z;
myPoint() {
m_x=0;m_y=0;m_z=0;
myPoint(myPoint p) {
m_x=p.getx();m_y=p.gety();m_z=p.getz();
// ---------------------------------------------------------------------------------Thank you for the reply but still have problem.
I created a directory classes and the directories look like:
C:\otman\java\
TestPoint.java
classes\
geometry\
src\
myPoint.java
When I compile using the line command:
C:\otman\java>javac -g -d classes geometry\src\myPoint.java TestPoint.java
I get the error:
TestPoint.java:8: cannot find symbol
symbol : constructor myPoint()
location: class geometry.src.myPoint
myPoint p = new myPoint();
^
1 error
Now the directories look like:
C:\otman\java\
TestPoint.java
classes\
geometry\
src\
myPoint.class
geometry\
src\
myPoint.java
I think that myPoint was compiled without problem but TestPoint was not compiled and it gives 1 error.
Can you help me? Thanks.<!--Session data--> -
Hi all, I am trying to write my first class file, been away
from flash for so long now and im just starting with as3, I have a
problem with this class file
I keep get an error
here is my class // it is in the same directory as my fla,swfHi ActionScripter1,
If I am not wrong you are not using feature of a document
class in Flash file.
I have modified the class given by you to set it as a
document class
to run this code you have to do following things:
1. Update the class with the class pasted below.
2. Remove all the code about preloadManager from the first
frame.
3. set your 'Document Class' property to preloadManager
As per my opinion this should be the way to implement a
preloader.
In this class you will have access to each and every object
placed on stage. and here 'this' refers to 'stage' only.
//Updated Class
package {
import flash.text.TextField;
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class preloadManager extends MovieClip {
public static var l:Loader = new Loader();
//CONSTRUCTOR for preloadManager Class
public function preloadManager()
trace("This is the start point of your programme")
startPreload('123.swf');
public function startPreload(swfFile) {
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
preloadLoop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE,
preloadComplete);
l.load(new URLRequest(swfFile));
}//end startPreload
public function preloadLoop(e:ProgressEvent):void {
var perc:Number=e.bytesLoaded/e.bytesTotal;
//percent is on my stage as a dynamic textField
//Error 1120: Access to undefined property percent
//how would I access this or pass it as a display reference
to my class?
percent.text=Math.ceil(perc*100).toString();
}//end preloadLoop
public function preloadComplete(e:Event):void {
removeChildAt(0);
percent=null;
addChild(l);
}//end preloadComplete
}//end class
}//end package -
Bad Class File error - Win2k & J2SDK1.4.0_01
Hi,
I am trying to run a 'Hello World' program which came with the FreeTTS package from links from the java.sun.com website, and am not able to compile the program. I get the error:
FreeTTSHelloWorld.java:4: cannot access file
cl.com.sun.speech.freetts.audio.Voice
bad class file: .\cl\com\sun\speech\freetts\audio\Voice.class
class file contains wrong class: com.sun.speech.freetts.Voice
Please remove or make sure it appears in the correct subdirectory of the classpath.
import cl.com.sun.speech.freetts.audio.Voice;
_______________________________________^
The FreeTTSHelloWorld.java File is printed below [its embarassingly simple..]
* Copyright 2001 Sun Microsystems, Inc.
import cl.com.sun.speech.freetts.audio.Voice;
import cl.com.sun.speech.freetts.audio.JavaClipAudioPlayer;
import cl.com.sun.speech.freetts.en.us.CMULexicon;
public class FreeTTSHelloWorld {
public static void main(String[] args) {
try {
String voiceClassName = (args.length > 0) ? args[0] :
"com.sun.speech.freetts.en.us.CMUDiphoneVoice";
Class voiceClass = Class.forName(voiceClassName);
Voice helloVoice = (Voice) voiceClass.newInstance();
helloVoice.setLexicon(new CMULexicon());
helloVoice.setAudioPlayer(new JavaClipAudioPlayer());
helloVoice.load();
helloVoice.speak
("Thank you for giving me a voice. I'm so glad to say
hello to this world.");
System.exit(0);
catch (Exception e) {
e.printStackTrace();
I've tried a billion things, including moving around the .class files [which, by the way, i extracted myself from the .jar files which came with the FreeTTS package - is that what i'm doing wrong? if so, please tell me - ] and still nothing happens - the same error results.
I've tried reading other cases similar to mine in the forums, but most of the things i read didn't apply to my (quite simple) situation, such as the 'package' line needing to be removed or anything like that..
I run Win2k and have j2sdk1.4.0_01 installed on my machine
I beg for anyone's help. Thanks in advance
-=-Miagi-=-Aha!
Extracting from the jar file might be ok, as long as the directory it's extracted into reflects the class's package name. Open the jar file using WinZip and you'll see that the files it contains are in directories that exactly mirror (including case) the package names.
The error you're getting tells you that java is looking in .\cl\com\sun\speech\freetts\audio\Voice.class (the '.\' means relative to your current working directory) and my bet would be that the file is not there!
You shouldn't need to extract these files at all, actually: Try deleting the files you extracted from the jar then try running your program again.
I hope this is helpful...
Chris. -
Extra bytes at the end of class file error
I have created an applet.
it worked fine when i ran it with appletviewer.
it ran fine when i opened it with a browser (when it still was on my computer and not on the net).
now, when i uploaded all the files, when try to open the page where my applet should be, the applet doesn't start and the console writes:
java.lang.ClassFormatError: Extra bytes at the end of class file ImageHolderNotifier
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
i tried rebuilding the project and uploading all the .class files from scratch... still, no change :-/
i have compiled it using eclipse 3.1.0, JDK1.5.0_02.
my JRE is 1.5.0_02
i've tried running it both with Internet Explorer and FireFox...Works locally but not after uploading.
Must be uploaded wrong then (ftp ascii??) or it's the web server. -
Custom Class file errors out on import javax.servlet.http.HttpSession
I am trying to write a class file to handle events. This is a test class file copied from the UIX Docs. When I put this in JDeveloper 903 ,and build it the compiler gives the error:
Error(2,27): cannot access class javax.servlet.http.HttpSession; file javax\servlet\http\HttpSession.class not found
I am not sure what is the problem? Can anyone please help?
Here is the code:--
package mypackage1;
import javax.servlet.http.HttpSession;
import oracle.cabo.servlet.Page;
import oracle.cabo.servlet.BajaContext;
import oracle.cabo.servlet.event.PageEvent;
import oracle.cabo.servlet.event.EventResult;
public class MyClass
/** This is handleStoreNameEvent version 1 */
public static EventResult handleStoreNameEvent(BajaContext context,
Page page,
PageEvent event)
String userName = event.getParameter("txt1");
HttpSession session = context.getServletRequest().getSession(true);
session.putValue("User Name", userName);
Page nextPage = new Page("NextPage");
return new EventResult(nextPage);
}Hi, you are missing the servlet.jar file from your classpath.
In JDeveloper, you can add this by opening up your project -> libraries and adding the servlet runtime library. -
BAD CLASS FILE ERROR WHEN TRYING TO CALL JAVA CLASS IN WEB-INF DIRECTORY
I AM NEW TO THIS FORUM. PLEASE HELP ME IDENTIFY/RESOLVE THIS ERROR - bad class file: /java/tomcat/webapps/ChoiceTel/WEB-INF/classes/XYZ/SMUA.class. OTHER JSP SCRIPTS THAT CALL JAVA CLASSES DO WORK WELL.
THE FUNNY THING ABOUT COMPILIING THIS JAVA CLASS WAS - I HAD TO A jar xvf OF activation.jar and mail.jar IN THE XYZ DIRECTORY BEFORE SUCCESSFULLY COMPILING SMUA.
THE CALL BEING MADE FROM THE JSP SCRIPT IS AS FOLLOWS:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<BODY>
<%@ page import="XYZ.*" %>
<%!
%>
<%
SMUA sndmail = new SMUA();
sndmail.postMail ("[email protected]","Test Subject","What Message","[email protected]");
%>
</BODY>
</HTML>Dude. Please don't shout. If your keyboard is like mine, it can produce both upper and lower case letters. Please use them appropriately.
Do you have the activation.jar/mail.jar available in the WEB-INF/lib directory for this application? -
Problem for retriveing servlet class file (error in DD) I think so
hi to all ,
my deployment descriptor is here ....
I tried to access servlet ... I got the response is like that
The requested Resource is not available
why its happening ?
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<welcome-file-list>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<listener>
<listener-class>CallMonitor.MyListener</listener-class>
</listener>
<servlet>
<servlet-name>LoginAction</servlet-name>
<servlet-class>LoginAction</servlet-class>
</servlet>
<servlet>
<servlet-name>InsertData</servlet-name>
<servlet-class>InsertData</servelt-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginAction</servlet-name>
<url-pattern>/LoginAction</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>InsertData</servlet-name>
<url-pattern>/InsertData</url-pattern>
</servlet-mapping>
<context-param>
<param-name>jdbcurl</param-name>
<param-value>jdbc:mysql://localhost:3306/test</param-value>
</context-param>
</web-app>But i remove the code from it , i can access LoginAction Servlet..
<servlet>
<servlet-name>InsertData</servlet-name>
<servlet-class>InsertData</servelt-class>
</servlet>
<servlet-mapping>
<servlet-name>InsertData</servlet-name>
<url-pattern>/InsertData</url-pattern>
</servlet-mapping>
In Tomcat manager i found the applicaton is not running.
i started the application using start command...
But i got error message
FAIL - Application at context path /25.7 could not be started
Message was edited by:
kannankalli<servlet-class>InsertData</servelt-class>Closing element for <servlet-class> is wrong.
Before posting for any help check following stuff
- Whether deployment descriptor is well-formed
- Whether it is valid i.e. all elements are properly placed -
When starting my app (under 1.2.2 and 1.3.1 on Linux), something like this gets printed to the screen:
MyClassName@76f0bf
The hex number changes with each print out. The app seems to behave correctly, though. It appears that every time the JVM uses this particular class, it gets printed. What does this mean?
Thank you.It probably means that there's a line of code somewhere in your app that looks like this:System.out.println(this);What you are seeing is the default output of an object's toString method.
-
How to load binary content of a .class file?
Hello everyone,
I want to load the binary content of a .class file in a dynamic approach. In more detail, I want it to work in the following approach. When given the name of a class, I can retrieve the binary content of the .class file. I have written the following sample but it does not work. Can anyone help to find what is wrong with my sample? How to achieve my goal?
String className = this.getClass().getName();
InputStream inputStream = this.getClass().getResourceAsStream (className);When executing the above code, the inputStream is always returned as "null".
Thanks in advance,
GeorgeThanks ruthf104,
I haven't tested this, but I think you will need to
transform the class name
"test.Foo"
into the resource path
"/test/Foo.class"
ie change '.' to '/', append '/' at the beginning
and ".class" at the end.
See the following paragraph from the
Class.getResourceAsStream specification:
"This method delegates the call to its class loader,
, after making these changes to the resource name: if
the resource name starts with "/", it is unchanged;
otherwise, the package name is prepended to the
resource name after converting "." to "/". If this
object was loaded by the bootstrap loader, the call
is delegated to
ClassLoader.getSystemResourceAsStream."
By these rules, the method will not be able to
automatically transform the class name into a
resource path for you (it doesn't append the
".class"), so you'll have to do it yourself.I have verified that your approach is working!
regards,
George -
VM crashes with big class files generated of JSPs
Hi,
When calling certain JSP pages with WebLogic Server 5.1 (SP 6) the HotSpot Virtual Machine (JDK1.3) crashes with a core dump.
Using WebLogic as the JSP engine produces of every JSP page one java file which
is compiled with javac to one class file. Each generated java file consists of
just one method: _jspService(...){...}. One method is allowed to be of 64 K
(the dynamic part 32 K as maximum). As we include other JSP pages and
components and use taglibraries, the WebLogic JSP engine generates a very big
java file (more than 1 MB). Javac compiles this to a class file which only
method exceeds the 64 K limit. As the javac compiler does not reject the class
file with the to big method the virtual machine crashes.
Running the same JSP page on Windows NT 4 with WebLogic Server 5.1 (Service Pack 6)
and JDK 1.3 BUT using the java option -classic works.
Unfortunately it seems that there is no -classic option for java on Solaris for JDK1.3.
Using JDK1.2 (JDK_1.2.2_05a) on Solaris or the jikes compiler of Jakarta
causes an exception instead of a core dump but still does not work.
Using solaris jdk1.2.2_05a the same page request results in the following exception:
Tue Nov 21 09:08:16 CET 2000:<I> <WebAppServletContext-maxblue> Generated java file:
/opt/tadevw/maxblue/weblogic/maxblue_cluster/maxblue_server/public_html/WEB-INF/_tmp_war/jsp_servlet/_portfolio/_PortfolioMyportfolio.java
Tue Nov 21 09:08:24 CET 2000:<E> <WebAppServletContext-maxblue> Servlet failed with Exception
java.lang.VerifyError: (class: jsp_servlet/_portfolio/_PortfolioMyportfolio, method:
_jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V) Illegal target of jump or branch
Is there a way that the JSP engine of WebLogic creates/generates
more than one function? (Without reengineering of the source code?)
Regards,
Boris
Thank you! I had no idea. But what is a FAT32 drive? Is it the work bench in the Mac, that is used for the transfering between the external hard drives? Is there any way around this then?
I thought in these HD home movie days, that this was an easy thing dealt with everyday. I still need to understand what practical solutions I can find. The files are .mov - quicktime files.
It couldn't be the case that files larger than 4BG should be locked in the hard drive forever?
Sverre -
Can you update .class files in a running portal instance?
We are developing with wlportal4.0 sp2/wlserver6.1 sp2 and we're having a problem
with the .class files which define our custom servlets, tag-libraries, etc. We store
all of the class files required by the portal under (obviously) the web-apps "WEB-INF/classes"
directory, following the standard J2EE servlet contract. Everything works fine,
but if we change one of the .class files while the server is running, no matter which
.class file it is, we receive a "Webflow Configuration Error":
Webflow Configuration Error:
XML File: portal.wf
Current Namespace: portal
Configuration Error Message:
ClassCastException was throw while trying to cast class [com.bea.p13n.appflow.webflow.internal.IPProcessor]
to [{1}].
.. Followed by a dump of the pipeline session and the session attributes. The only
way to get around this we've found is to stop and re-start the portal which, obviously,
is a pain.
Has anybody run into this situation and found a workaround?
Thanks!Seeing how your getting an webflow type error. If these classes are inputprocessors
issue a support ticket about "hot deployments of input processors"
-Travis
"Joshua Davies" <[email protected]> wrote:
>
We are developing with wlportal4.0 sp2/wlserver6.1 sp2 and we're having
a problem
with the .class files which define our custom servlets, tag-libraries, etc.
We store
all of the class files required by the portal under (obviously) the web-apps
"WEB-INF/classes"
directory, following the standard J2EE servlet contract. Everything works
fine,
but if we change one of the .class files while the server is running, no
matter which
.class file it is, we receive a "Webflow Configuration Error":
Webflow Configuration Error:
XML File: portal.wf
Current Namespace: portal
Configuration Error Message:
ClassCastException was throw while trying to cast class [com.bea.p13n.appflow.webflow.internal.IPProcessor]
to [{1}].
... Followed by a dump of the pipeline session and the session attributes.
The only
way to get around this we've found is to stop and re-start the portal which,
obviously,
is a pain.
Has anybody run into this situation and found a workaround?
Thanks! -
Hi folks,
I've got a peculiar problem here :-( ...
I've got this Java code (that uses an external jar) that compiles fine. But whenever I try to run the code it gives me a truncated class file error. And I am getting this error only in Solaris and not in Windows !!!
Following is the trace that I am getting:
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:495)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:110)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$1(URLClassLoader.java:217)
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:192)
at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:290)
at java.lang.ClassLoader.loadClass(ClassLoader.java:256)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
Initially I thought that the class file might be broken. But even after numerous recompiling the problem is still persiisting :-(. Any idea fellas ?BadCoder,
[Oh, wicked, bad naughty coder|http://www.sacred-texts.com/neu/mphg/mphg.htm#Scene%2011] (read it through then [consult the book of armaments|http://www.youtube.com/watch?v=xOrgLj9lOwk&feature=related]).
Any idea fellas ? Nope. Absolutely none. I have consulted the chicken entrails, and the news ain't good. Have you considered suicude?\
Yeah that might be overdoing things somewhat.
So what happens if you compile on Solaris. Are you using the exact same versions of javac and java on both machines? Do you have control over that? Hint: you can install whichever JVM you like on solaris, to your ~ without affecting other users... but "the" version tends to age somewhat, what with a 5 year MTBF and all.
Cheers. Keith. -
Java Programming: Any Ideas for breaking a huge class file into smaller ?
Hello Java pros,
I have some very huge class files, some with dozens of methods; each method containing an average of a screen-page full of code.
Obviously, such huge class files are difficult to maintain inspite of using an IDE, especially when changes have to be made to a bunch of a category of methods scattered all over the class.
I am wondering if there are ways/best-practices out there to make the core class file smaller/smarter - fr eg.
<a> by retaining the real core definitions within the core class and moving the detailed implementation outside the core class
<b> by breaking down the file into more manageable pieces - something to the effect of using 'include' files that some languages support
etc.
Thanks for your help in advance.
Sree NidhiIf you have huge class files with dozens of methods, maybe the design of your application is not so sound. You could use all kinds of OO design techniques to design your application so that it is easier to maintain.
Start by learning about design patterns. The most famous book about design patterns is this one: http://www.amazon.com/exec/obidos/ASIN/0201633612/qid=1029971487/sr=2-1/ref=sr_2_1/102-4299125-5141710
Here is also a nice book about anti-patterns: http://www.antipatterns.com/
Jesper
Maybe you are looking for
-
I added Icloud to join my calendar on my phone to another person. It erased all history date from previous months. how do I get that data back?
-
Export internal table to memory in User Exit FM
Hi all, My scenario here is to export an internal table in one user exit FM and import it back in another user exit FM. I was trying to use Export lt_table to memory id 'LABEL'. then Import lt_table from memory id 'LABEL'. But then i hit error in the
-
Downloading Images from a Gallery
Just having a mental blank. I am creating a SWF to be placed on a CD with a gallery section. Once an image is loaded from the gallery, I would like the option of downloading that file to their computer. All images will be contained in the same folder
-
Browse in iBooks on my iPad does not work. When tapping on the author name nothing appears. Is anyone else having this problem?
-
3d box with images in perspective
I used a box with an extrude and bevel effect in illustrator but I cannot remember how I took artwork and text and placed it on top of the box so it would be in perspective with the box. Any suggestions?