Problems with java.lang.Class in JDK1.3

Hi,
I have 3 problems with the reflection in java.lang.Class:
1) In the specification of method java.lang.Class.getDeclaredFields() is wrote:
"Returns .... This includes public, protected, default (package) access, and private fields ..."
This means, that all private fields should be return too. But some private methods are not given back. ????
2) In java.lang.Class.getDeclaredMethods()
some public methods are not return. ????
3) In java.lang.Class.getDeclaredMethods()
If Class is an interface. The same problem like 2) ????
Are they errors of java.lang.Class in JDK1.3 ????
Thanks & sincerely.

Not sure it makes a difference, but you left off the last part of the quote:
This includes public, protected, default (package) access, and private classes and interfaces declared by the class, but excludes inherited classes and interfaces.
Are these missing methods from inherited classes, or are they declared in the class itself?

Similar Messages

  • Problems with java.lang.NoClassDefFound error *solved*

    realising my stupidity I have solved the problem
    I am quite new to java and I have been using the Java for Dummies book to help me to learn it. I decided to use the command line tools instead of an IDE and hadn't encountered any problems until recently. I took a break from learning Java after reaching the end of the book but have decided to come back to it. The problem now is that when I run my programs I get the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: helloworld (wrong anme: HelloWorld)
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$000(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPriviledged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.localClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    This occurs from a simple hello world program:
    class HelloWorld
       public static void main(String[] args)
          System.out.println("Hello, World!");
    }I have no idea what the problem is, although by looking at similar threads it would appear that it may be something to do with the classpath variables however I do not know much about this as I followed a tutorial on the internet to set the classpath up.
    Edited by: this_is_phil on Jun 19, 2008 11:11 AM

    this_is_phil wrote:
    Exception in thread "main" java.lang.NoClassDefFoundError: helloworld (wrong anme: HelloWorld)This part of the error message means you typed in "helloworld" but the class that java found was named HelloWorld. In Java, those are different - java is case sensitive. It will work if you enter HelloWorld.

  • Problems with java.lang.Double in a Pojo

    Hi!
    I'm getting some problems with a Double (wrapper class) in a sub-report related with a Pojo.
    The exception has more than 100 lines.
    It's starts with:
    at com.crystaldecisions.sdk.occa.report.application.ds.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
         at br.inf.teorema.javautils.util.CrystalReportsUtils.export(CrystalReportsUtils.java:520)
    Caused by: com.crystaldecisions.sdk.occa.report.application.b6: Valor nulo inesperado localizado para o membro Produto.getAliquotaICMS. (UNEXPECTED NULL VALUE ... )
    at com.crystaldecisions.sdk.occa.report.application.b6.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.de.a(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.de.if(Unknown Source)
    at com.crystaldecisions.sdk.occa.report.application.de.getDouble(Unknown Source)
    and ends with:
    [JRCCommunicationAdapter]  detected an exception: Erro inesperado do conector do banco de dados (UNEXPECTED ERROR WITH DATABASE CONNECTOR )
         at com.crystaldecisions.reports.queryengine.Row.char(Unknown Source)
         at com.crystaldecisions.reports.queryengine.Row.getValue(Unknown Source)
         at com.crystaldecisions.reports.datalayer.a$d.getValue(Unknown Source)
         at com.crystaldecisions.reports.saveddata.saveddata.SavedData.a(Unknown Source)
         at com.crystaldecisions.reports.saveddata.a.a(Unknown Source)
         at com.crystaldecisions.reports.saveddata.a.a(Unknown Source)
         at com.crystaldecisions.reports.basicdataengine.a.p(Unknown Source)
         at com.crystaldecisions.reports.basicdataengine.a.a(Unknown Source)
    It occurs when my Double has null value. When I put "0.0", there are no problems.
    Anyway, in specifics contexts, null != 0.0.
    I think it's a bug. Someone encountered the same problem?

    Sorry for my insistence, but this problem occurs only for me?
    I will explain better.
    If I have a report that show the value of a Double field, the getter method should be:
    public Double getMyField() {
        return myField;
    But if myField == null, I can't generate the report.
    So, I did:
    public Double getMyField() {
        if (myField == null) {
            myField = 0.0d;
        return myField;
    I wish don't need to do this correction in getter method.
    CR do not works this way with Double?
    I have tested, and String works fine.

  • Ugly problem with java.lang.reflect.InvocationTargetException

    Hello,
    I am writing a web service which connects to WebSphere MQ queue manager and puts a message on a queue.
    I use Eclipse and as usual I followed more or less the hints given at:
    http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/BottomUpWebService.html
    I have chosen Tomcat 5.5.20 as target server (had to, because otherwise it does not create a server-config.wsdd file), the web service WSDL thingies and the client were created successfully.
    I have created WAR files and everything went fine when I tested the thing on JBoss.
    Bad things started after I deployed the things on the Tomcat server. When I start the client I receive java.lang.reflect.InvocationTargetException as a result. The web service itself does not generate any exception, but the client does (I'll post the dump later..).
    During the debug it turned that the exception is generated at the moment when the web service program tries to call any of the WebSphere functions.
    Now - 1st obvious thing was to check if I have com.ibm.mq.jar in the WEB-INF/lib directory inside my WAR files. Yep! There it was.
    So.. if the thing works just fine on JBoss and it booms on Tomcat I wonder whats the hack here? I copied all of the MQ libraries i have from JBOSS_HOME/lib to CATALINA_HOME/shared/lib and CATALINA_HOME/common/lib. Well.. that's quite ugly, because all necessary jars are inside the WEB-INF/lib directory. Anyway nothing of the above helped me running the thing on Tomcat.
    Do you have any suggestions or have anyone of you ever had such problem?
    Here are the exception dump and part of the code:
      - Setting up MQ environment:
         - Setting hostname...
    An AxisFault exception occured: java.lang.reflect.InvocationTargetException
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.reflect.InvocationTargetException
    faultActor:
    faultNode:
    faultDetail:
         {http://xml.apache.org/axis/}hostname:ghjvk0j
    java.lang.reflect.InvocationTargetException
         at org.apache.axis.message.SOAPFaultBuilder.create
    Fault(SOAPFaultBuilder.java:222)
         at org.apache.axis.message.SOAPFaultBuilder.endElement(
    SOAPFaultBuilder.java:129)
         at org.apache.axis.encoding.DeserializationContext.endElement(
    DeserializationContext.java:1087)
         at org.apache.xerces.parsers.AbstractSAXParser.endElement(
    Unknown Source)
         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.
    scanEndElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScanne
    rImpl$Fragment ContentDispatcher.dispatch(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerI
    mpl.scanDocument(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
    Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
    Source)
         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
    Source)
         at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse
    (Unknown Source)
         at javax.xml.parsers.SAXParser.parse(Unknown Source)
         at org.apache.axis.encoding.DeserializationContext.parse(
    DeserializationContext.java:227)
         at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
         at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
         at org.apache.axis.handlers.soap.
    MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
         at org.apache.axis.client.Call.invoke(Call.java:2767)
         at org.apache.axis.client.Call.invoke(Call.java:2443)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at pl.pzu.services.TfiAuthenticationSoapBindingStub.
    verify(TfiAuthenticationSoapBindingStub.java:245)
         at pl.pzu.services.TfiAuthenticationProxy.
    verify(TfiAuthenticationProxy.java:45)
         at org.apache.jsp.sampleTfiAuthenticationProxy.
    Result_jsp._jspService(Result_jsp.java:158)
         at org.apache.jasper.runtime.HttpJspBase.
    service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.
    service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.
    service(JspServletWrapper.java:334)
         at org.apache.jasper.servlet.JspServlet.
    serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.
    service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    (ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(
    ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(
    StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke
    (StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(
    StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(
    ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(
    StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(
    CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(
    Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11Connec
    tionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Pool
    TcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(Lea
    derFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
    ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)There is the part of the web service code where the event occurs:
         public void writeMessage(String message,
    String message_ID) throws Exception
              System.out.println("      - Setting up MQ environment: ");
              try
                   System.out.println("      - Setting hostname...");
         NEXT LINE CAUSES THE CLIENT TO THROW
         This is the first call to any WebSphere assets.
         During debug It says the it is unable to inspect the MQEnvironment
         object...
                   MQEnvironment.hostname = m_config.getQMHost();
                   System.out.println("      - Setting port...");
                   MQEnvironment.port = m_config.getQMPort();
                   System.out.println("      - Setting channel...");
                   MQEnvironment.channel = m_config.getQMChannel();
         }I think that if it works on JBoss and it doesn't on Tomcat it is not coding problem, but rather a configuration...
    Thanx for any ideas or help from ur side.

    Did you have any success on this?
    I also have the same problem with Tomcat 6.
    I had Tomcat 5.0 working with this code, but when we migrated to Tomcat 6.0, I am getting this exception on the clent side. I figured out that it is occuring on invoking WebSphere MQ call from the code.
    Thanks

  • Problem with java.lang.OutOfMemoryError

    hi
    i am developping a web application
    i am using jfreechart in my jsf application to generate statistic diagrams
    to update my diagrams i am calling the methode ChartUtilities.saveChartAsPNG(file1, chart, 400, 300, null) every 10 seconds
    my application become more and more slow and the cpnsommatio of memory is more and more important until getting this exception:
    javax.faces.el.EvaluationException: java.lang.OutOfMemoryError: Java heap space
         at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at javax.faces.component.UICommand.broadcast(UICommand.java:387)
         at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
         at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
         at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
         at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
         at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409)
         at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at TimeoutFilter.doFilter(TimeoutFilter.java:64)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
         at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
         at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
         at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.OutOfMemoryError: Java heap space
         at java.awt.image.DataBufferInt.<init>(Unknown Source)
         at java.awt.image.Raster.createPackedRaster(Unknown Source)
         at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
         at java.awt.image.BufferedImage.<init>(Unknown Source)
         at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1407)
         at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1389)
         at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:183)
         at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:320)
         at SWIMLogStatistiques.generateChartMethod(SWIMLogStatistiques.java:98)
         at SWIMmoduleStatistiques.generateChartMethod(SWIMmoduleStatistiques.java:39)
         at ListModules.mesServicesAttributs(ListModules.java:199)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
         at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
         at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
         at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at javax.faces.component.UICommand.broadcast(UICommand.java:387)
         at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
         at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
         at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
         at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
         at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409)
         at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    after doing some searches, i found that the solution is to change the memory allocated for the JVM but in my case, the memory consommed by my application is increasing along with time.
    i think that the problem is with:*ChartUtilities.saveChartAsPNG(file1, chart, 400, 300, null);*:does this instruction consume a lot of memory and how can i resolve thos problem?

    riadhhwajdii wrote:
    i am using jfreechart in my jsf application to generate statistic diagrams
    to update my diagrams i am calling the methode ChartUtilities.saveChartAsPNG(file1, chart, 400, 300, null) every 10 seconds
    my application become more and more slow and the cpnsommatio of memory is more and more important until getting this exception:This bit (slowing down over several cycles of the code)..and this bit:
    after doing some searches, i found that the solution is to change the memory allocated for the JVM but in my case, the memory consommed by my application is increasing along with time.(increasing memory simply delays the exception), are usually a pointer that you have a memory leak somewhere.
    i think that the problem is with:*ChartUtilities.saveChartAsPNG(file1, chart, 400, 300, null);*:does this instruction consume a lot of memory and how can i resolve thos problem?Take some heap dumps (especially when the out of memory occurs) and stick them in a memory analyser. Just because the exception is being thrown during saveChartAsPNG() does not mean that's the culprit. All that means is it was the final straw.

  • Questions with java.lang.Class

    1.What's the use of Class.getClasses() & Class.getDeclaredClasses()?
    I wrote the class below:
    public class ClassDemo {
       public String str = new String();
       public Integer inte = new Integer(0);
       public static void main(String[] args) throws Exception {
         ClassDemo cd = new ClassDemo();
         Class c = cd.getClass();
         Class classes[] = c.getDeclaredClasses();
         for(int i = 0; i <= classes.length; i++) {
            System.out.println(classes.getName());
    But it thrown java.lang.ArrayIndexOutOfBoundsException.
    I checked, just because the classes.length is zero.
    Why? I declared two String class inside the ClassDemo,but why the getDeclaredClasses() return zero class?
    What does the declared classes mean?
    And , what 's the difference between getClasses() & getDeclaredClasses()?
    Can u give me an example?
    2.What's the use of Class.getComponentType()? what is the component type ?

    Dude, they never give you a direct answer on this
    forum. read it as they never spoon feed you(actually they do somethimes!).
    They much prefer to have you spend more time
    trying to figure it out for yourself (which is good)
    than you already have done. And, if you're like me,
    you've probably been giving whatever your problem is
    a blast for a number of days before you've given in
    and come here to ask this wretched batch of not very
    helpful individuals.You think this wonderful batch of highly helpful indivisuals get paid for answering your question. They tell you where your mouth is, where the food is, even how to grab it and eat it. If you are expecting them to grab it and put it into your mouth.....you need to checkout the best kindergarten around. Best of Luck.
    Oh, once your page drops off the first page in the
    forum, no one will ever read if again!If you have taken notice you would know that hardly a question goes past the first page, if it really does then it either has to be a cross-post/something irrelevant/ wrong forum /written by a boor(I mean someone like u).
    I've found answers for all my questions I've asked them so far. I find this place wonderful to hang out rather than trawling the web for interview questions. May be u should change your attitude.

  • Problem with  java.lang.reflect in Eclipse

    I'm just reading java tutorial about that library, but when i'm trying to execute those example program's e.g
    import java.lang.reflect.Constructor;
    import java.lang.reflect.Type;
    import static java.lang.System.out;
    public class ConstructorSift {
        public static void main(String... args) {
         try {
             Class<?> cArg = Class.forName(args[1]);
             Class<?> c = Class.forName(args[0]);
             Constructor[] allConstructors = c.getDeclaredConstructors();
             for (Constructor ctor : allConstructors) {
              Class<?>[] pType  = ctor.getParameterTypes();
              for (int i = 0; i < pType.length; i++) {
                  if (pType.equals(cArg)) {
                   out.format("%s%n", ctor.toGenericString());
                   Type[] gpType = ctor.getGenericParameterTypes();
                   for (int j = 0; j < gpType.length; j++) {
                   char ch = (pType[j].equals(cArg) ? '*' : ' ');
                   out.format("%7c%s[%d]: %s%n", ch,
                        "GenericParameterType", j, gpType[j]);
                   break;
    // production code should handle this exception more gracefully
         } catch (ClassNotFoundException x) {
         x.printStackTrace();
    in Eclipse i've got nothing in my output console :/
    no errors, no warnings, no text ..... (it was terminated correctly)
    Can somebody tell me what should I do to make it work properly ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    In program arguments, you should not have ConstructorSift but only java.util.Formatter and java.util.Locale.
    (Eclipse : run dialog | arguments tab | program arguments)
    This is the output you should get:
    $ java ConstructorSift java.util.Formatter java.util.Locale
    public java.util.Formatter(java.util.Locale)
    *GenericParameterType[0]: class java.util.Locale
    public java.util.Formatter(java.lang.Appendable,java.util.Locale)
    GenericParameterType[0]: interface java.lang.Appendable
    *GenericParameterType[1]: class java.util.Locale
    public java.util.Formatter(java.lang.String,java.lang.String,java.util.Locale) throws java.io.FileNotFoundException,java.io.UnsupportedEncodingException
    GenericParameterType[0]: class java.lang.String
    GenericParameterType[1]: class java.lang.String
    *GenericParameterType[2]: class java.util.Locale
    public java.util.Formatter(java.io.File,java.lang.String,java.util.Locale) throws java.io.FileNotFoundException,java.io.UnsupportedEncodingException
    GenericParameterType[0]: class java.io.File
    GenericParameterType[1]: class java.lang.String
    *GenericParameterType[2]: class java.util.Locale
    public java.util.Formatter(java.io.OutputStream,java.lang.String,java.util.Locale) throws java.io.UnsupportedEncodingException
    GenericParameterType[0]: class java.io.OutputStream
    GenericParameterType[1]: class java.lang.String
    *GenericParameterType[2]: class java.util.Locale
    Hope that help,
    Jack

  • Dyna Form +Validator Framework--- peculair problem with java.lang.Integer

    In my struts application , i m using Dyna Action form,and Validator framework
    <form-bean
    name="myDynaForm"
    type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="name" type="java.lang.String"/>
    <form-property name="phoneNo" type="java.lang.Integer"/>
    </form-bean>
    Now if user does not enter name , then a error meassage is dispalyed,
    and aslo this time phoneNo shows 0.
    why 0 is displayed here?
    Can anybody tell me

    Hi all,
    If my memory serves me well, the exception is thrown because the application needs a working calendar for a person provided in time mangement. Make sure the correct infotypes are used. Also the organization structure needs to be set up correctly. The manager needs someone to approve and the employee needs someone to get approved by.
    Regards, Marcel.

  • Java.lang.Class- getFields() results in JVM crash when called through JNI

    From a C++ application, I use Invocation APIs to create a JVM and call some Java methods using JNI
    I get a crash in jvm.dll with EXCEPTION_ACCESS_VIOLATION
    when I try to call "getFields" method of java.lang.Class in order to get the Fields of the java class
    This method call, should return a java/lang/reflect/Fields[] on success
    I am able to get the method ID of this method by using pEnv->GetMethodID(..)
    However, when I call this method using CallObjectMethod(..), HotSpt JVM crashes with access violation with the dump given below.
    Any clues on how to debug and find the problem?
    Or has anyone tried getting the fields of a Java class from C++ by calling reflection APIs uing JNI?
    Thanks in advance!
    Sample code
    jclass testerClass = pEnv->FindClass("com/test/Tester");
    jmethodID cid = pEnv->GetMethodID(testerClass,"<init>","()V");
    if(NULL == cid)
    pEnv->ExceptionDescribe();
    jobject testerObject = pEnv->NewObjectV(testerClass, mid);
    jmethodID mid = pEnv->GetMethodID(testerClass, "getClass",
                             "()Ljava/lang/Class;");
    jobject clsObj = (jobject)pEnv->CallObjectMethod(testerObject, mid);
    pEnv->ExceptionDescribe();
    jclass      jCls = pEnv->GetObjectClass(clsObj);
    jmethodID midGetFields = pEnv->GetMethodID(jCls, "getFields",
                                            "()[Ljava/lang/reflect/Field;");
    jobjectArray jobjArray = (jobjectArray)pEnv->CallObjectMethod(testerObject, midGetFields);
    pEnv->ExceptionDescribe();
    Crash dump
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x809E69F
    Function=JVM_FindSignal+0x11505
    Library=D:\Java\j2re1.4.2_03\bin\client\jvm.dll
    Current Java thread:
         at java.lang.Class.privateGetDeclaredFields(Unknown Source)
         at java.lang.Class.privateGetPublicFields(Unknown Source)
         at java.lang.Class.getFields(Unknown Source)
    Dynamic libraries:
    0x00400000 - 0x00419000      E:\SC\SC12.1\SCApplications\SNMP\Bin\JNITester.exe
    0x77F50000 - 0x77FF7000      C:\WINDOWS\System32\ntdll.dll
    0x77E60000 - 0x77F46000      C:\WINDOWS\system32\kernel32.dll
    0x10000000 - 0x10023000      E:\SC\SC12.1\SCApplications\SNMP\Bin\JniUtils.dll
    0x00320000 - 0x00332000      E:\SnmpIpmNativeTestDriver\MTFStubHelper.dll
    0x00340000 - 0x0035B000      E:\SnmpIpmNativeTestDriver\MTFXMLFileAPI.dll
    0x12000000 - 0x122B1000      e:\sc\sc12.1\bin\xerces-c_2_2_0D.dll
    0x77DD0000 - 0x77E5D000      C:\WINDOWS\system32\ADVAPI32.dll
    0x78000000 - 0x78086000      C:\WINDOWS\system32\RPCRT4.dll
    0x10200000 - 0x1026C000      e:\sc\sc12.1\bin\MSVCRTD.dll
    0x102A0000 - 0x102B7000      e:\sc\sc12.1\bin\MSVCIRTD.dll
    0x5F800000 - 0x5F8E9000      e:\sc\sc12.1\bin\MFC42uD.DLL
    0x77C70000 - 0x77CB0000      C:\WINDOWS\system32\GDI32.dll
    0x77D40000 - 0x77DCC000      C:\WINDOWS\system32\USER32.dll
    0x5F700000 - 0x5F746000      e:\sc\sc12.1\bin\MFCD42uD.DLL
    0x5F500000 - 0x5F5C6000      e:\sc\sc12.1\bin\MFCO42uD.DLL
    0x10480000 - 0x104FE000      e:\sc\sc12.1\bin\MSVCP60D.dll
    0x15020000 - 0x15042000      e:\sc\sc12.1\bin\SCTraceLib.dll
    0x6D510000 - 0x6D58D000      C:\WINDOWS\System32\dbghelp.dll
    0x77C10000 - 0x77C63000      C:\WINDOWS\system32\msvcrt.dll
    0x77C00000 - 0x77C07000      C:\WINDOWS\system32\VERSION.dll
    0x00360000 - 0x0037D000      e:\sc\sc12.1\bin\SCFileManager.dll
    0x76BF0000 - 0x76BFB000      C:\WINDOWS\System32\PSAPI.DLL
    0x00420000 - 0x00580000      e:\sc\sc12.1\bin\BctCoreCL.dll
    0x5D920000 - 0x5D929000      C:\WINDOWS\System32\RPCNS4.dll
    0x71B20000 - 0x71B31000      C:\WINDOWS\system32\MPR.dll
    0x71C20000 - 0x71C6E000      C:\WINDOWS\System32\NETAPI32.dll
    0x71AB0000 - 0x71AC5000      C:\WINDOWS\System32\WS2_32.dll
    0x71AA0000 - 0x71AA8000      C:\WINDOWS\System32\WS2HELP.dll
    0x15000000 - 0x15012000      e:\sc\sc12.1\bin\CTEventLog.dll
    0x773D0000 - 0x77BC2000      C:\WINDOWS\system32\SHELL32.dll
    0x70A70000 - 0x70AD4000      C:\WINDOWS\system32\SHLWAPI.dll
    0x771B0000 - 0x772D1000      C:\WINDOWS\system32\ole32.dll
    0x77120000 - 0x771AB000      C:\WINDOWS\system32\OLEAUT32.dll
    0x1F7A0000 - 0x1F7D6000      C:\WINDOWS\System32\ODBC32.dll
    0x77340000 - 0x773CB000      C:\WINDOWS\system32\COMCTL32.dll
    0x763B0000 - 0x763F5000      C:\WINDOWS\system32\comdlg32.dll
    0x08000000 - 0x08138000      D:\Java\j2re1.4.2_03\bin\client\jvm.dll
    0x76B40000 - 0x76B6C000      C:\WINDOWS\System32\WINMM.dll
    0x5FD00000 - 0x5FD0D000      C:\WINDOWS\System32\MFC42LOC.DLL
    0x71950000 - 0x71A34000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
    0x1F840000 - 0x1F857000      C:\WINDOWS\System32\odbcint.dll
    0x5DAC0000 - 0x5DAC7000      C:\WINDOWS\System32\rdpsnd.dll
    0x00FE0000 - 0x00FE7000      D:\Java\j2re1.4.2_03\bin\hpi.dll
    0x01000000 - 0x0100E000      D:\Java\j2re1.4.2_03\bin\verify.dll
    0x01010000 - 0x01029000      D:\Java\j2re1.4.2_03\bin\java.dll
    0x01030000 - 0x0103D000      D:\Java\j2re1.4.2_03\bin\zip.dll
    0x76C90000 - 0x76CB2000      C:\WINDOWS\system32\imagehlp.dll
    Heap at VM Abort:
    Heap
    def new generation total 576K, used 132K [0x15050000, 0x150f0000, 0x15530000)
    eden space 512K, 25% used [0x15050000, 0x15071250, 0x150d0000)
    from space 64K, 0% used [0x150d0000, 0x150d0000, 0x150e0000)
    to space 64K, 0% used [0x150e0000, 0x150e0000, 0x150f0000)
    tenured generation total 1408K, used 0K [0x15530000, 0x15690000, 0x19050000)
    the space 1408K, 0% used [0x15530000, 0x15530000, 0x15530200, 0x15690000)
    compacting perm gen total 4096K, used 964K [0x19050000, 0x19450000, 0x1d050000)
    the space 4096K, 23% used [0x19050000, 0x191410e0, 0x19141200, 0x19450000)
    Local Time = Wed Aug 25 21:06:44 2004
    Elapsed Time = 0
    # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
    # Error ID : 4F530E43505002EF
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode)

    You are right, I tried getting the java.lang.Class reference for the com.test.Tester by calling getClass() on com.test.Tester
    And using this jclass reference for java.lang.Class, I tried getting the method ID of getFields and eventually the Field[]
    Thanks for the help
    I have some more questions.
    Assumption - Using JNI, I got the fields array of com.test.Tester and I am iterating through the fields
    1.Assuming that the Tester class had an Integer field say m_nIntVal, then once I get the jobject equivalent of this Field in C++.
    Now I need to get the type of the field (I call the method java.lang.reflect.getType() from JNI)
    This gives me a jclass reference to it's type i.e java.lang.Integer
    2.I need to get the name of this type i.e I want to get the name of the type in a string as "java.lang.Integer"
    For this, on the jclass reference of java.lang.Integer got in Step 1, I call getClass() from JNI (to get the java.lang.Class) and then getName()
    Now, for calling getClass(), I need a temporary object reference corresponding to the jclass of java.lang.Integer, The problem is that Integer does not have a default constructor, so my call to create the jobject fails.
    But, since I do not know that I am constructing an Integer (remember that is what I am trying to find out - getType), I cant pass any values to constructor
    Now, how do I go about creating a jobject of Integer, without knowing that I am constructing that, as this does not have a default constructor without parameters
    Also, I tried using AllocObject to get the jobject and then tried to get the method ID of getClass(). Even this failed
    3. If the com.test.Tester class had a primitive "int" field, say m_nPrimitiveInt
    for which java provides a Class representation, I am able to get the jclass reference to the type of m_nPrimitiveInt
    Now, how do I get the name of the type as "int" in a string?
    Forllowing a similar procedure like in Step 2 fails when I try to pass the jclass reference to the type of m_nPrimitiveInt to the GetMethodID
    with the error FATAL ERROR in native method: JNI received a class argument that is not a class
    Can you tell me what is the way out?
    Thanks in advance,
    Also, can I mail you with some doubts that I have? If its ok, please contact me at [email protected]

  • Problems with java j2re using mozilla

    Hi,
    i'm using j2re1.4.2_05 plugin for mozilla in linux (Fedora Core 2). My internet access goes throught a router (SMC Networks ISDN Barricade SMC7301TA). It's settings can be edited throught a web browser LAN connection. And here the problems begin. On routers settings page a java output console (for error and other messages) is running, which doesn't work, despite java applications on other web pages work well (I tested it on sun's java test page and it's working properly). Java console exits the following errorr message:
    >
    load: class DynamicTable.class not found.
    java.lang.ClassNotFoundException: DynamicTable.class
         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)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more
    Is there a way to fix this problem? Cause without the command output it's mearly unpossible to configure the router.

    Yes i can make changes. Not everything is realised with java, just the output console, which reports if the changes i made succeded, prints out logs, gives additional info about some settings etc. So, i can make changes, but i have no response, for example: everytime i save something i don't know if the save was succesful. I can't take a look at IP routing table and DHCP configuration...
    On windows xp, using internet explorer (the default version for xp) everything works perfect. But mozilla for windows has also problems with java. I know i can still change settings on wins, but right now i'm having some problems with networking on linux and i have to set things up in it (besides i use wins only because of school purposes).

  • How to use java.lang.Class.getMethod() and java.lang.reflect.Method.invoke(

    I want to call a specified method of one class dynamically. I use the method
    "getMethod()" in package "java.lang.Class" to get method and "invoke()" in
    " java.lang.reflect.Method " to invoke method.
    The problem is as following :
    1. There are two argument in this method "getMethod(String MethodName , Class[] paremterTypes)" in package "Class". I have no idea about the second parameter " Class[] parameterTypes ".what does the argument exactly mean ?
    2. There are two argument in the method "invoke(object obj, object[] obj)" in package "Method".
    I have no idea about the second parameter "object[] obj ".what is mean ?
    I pass " null " value to it and it works.But i pass anothers ,jvm will throw exception.

    I have a generic Method Executer that has a method like
    public Object execute(String className, String methodName, Object args)
        String fullClassName = packageName + className ;
        Class delegateClass = Class.forName(fullClassName);
        BaseDelegate delegate = (BaseDelegate)delegateClass.newInstance();
        Method method = null;
        if (args == null)
            method = delegateClass.getMethod(methodName, new Class[] {});
            obj = method.invoke(delegate,new Object[] {});
        else
            method = delegateClass.getMethod(methodName, new Class[] {args.getClass()});
            obj = method.invoke(delegate, new Object[]{args});
       }This seems to have problems when I call the method from a class like:
    execute("CategoryDelegate", "getCategoryById", new Integer(4144));(I get a NoSuchMethodException)
    The method I am trying to execute in CategoryDelegate looks like:
    public Category getCategoryById(int categoryId) throws DelegateExceptionI think it has to deal with the difference in the way we handle Primitive Wrappers and Objects. Wrapper we have to use Interger.TYPE and with the rest of the Objects we have to use obj.class.
    Am I doing something wrong here? Any suggestions to make it work for primitive wrappers as well as Objects?

  • Early problems with Java on my Macbook.

    Hi, I am a former high school computer science student and I'm having problems with Java as I've recently moved from Windows to a Mac. The following is a letter I wrote to my prior computer science teacher but he does not seem to be responding. I think all you need to know is that DrawHouse and JumpingJacks are simple Java programs we made in class that utilize an object called DrawingTool (which is a graphics environment). DrawingTool is contained in gpdraw.jar and also was contained in our class' apcslib.jar. Also, FileInput is a class contained in apcslib.jar.
    I basically transferred all my JAR files (apcslib.jar, etc.) from my Windows computer to my Mac. I didn't think anything was wrong or corrupted with them because they're the same JAR files that I used for my Java programs on my Windows comp in high school and when I run those Java programs now, they still work. But for some reason if I try to run, say, DrawHouse or JumpingJacks with those same programs on my Macbook, it gives me the following errors on runtime (it compiles fine).
    Exception in thread "main" java.lang.NullPointerException
         at apcslib.DrawingTool.move( DrawingTool.java:456)
         at java.awt.Component.setLocation( Component.java:1705)
         at java.awt.Window.init( Window.java:289)
         at java.awt.Window.<init>( Window.java:318)
         at java.awt.Frame.<init>( Frame.java:419)
         at java.awt.Frame.<init>( Frame.java:384)
         at javax.swing.JFrame.<init>( JFrame.java:150)
         at apcslib.DrawingTool.<init>( DrawingTool.java:45)
         at apcslib.DrawingTool.<init>( DrawingTool.java:106)
         at JumpingJacks.main( JumpingJacks.java:35)
    So I thought, maybe I'm not importing the JAR files correctly. But if I import gsdraw.jar or a different apcslib.jar that I downloaded from some random teacher's website on the internet (and that also happens to have DrawingTool in it) then it compiles and runs fine. So I thought, ok, maybe it's a problem with this one particular apcslib.jar that I transferred from my Windows computer. But like I said, DrawHouse and JumpingJacks run fine on my windows comp, and most ridiculous of all, I tried running Tasmania on my Macbook (which uses the FileInput class from your apcslib.jar) and THAT works fine! So to recap, I'm not importing the JAR files wrong and at times there doesn't seem to be anything wrong with the apcslib.jar you gave us and probably not anything wrong with my IDE, seeing that importing of other JAR files works fine (I'm using eclipse and/or xcode, and the same problem occurs with both). Now of course, I could just go ahead and use the apcslib that I downloaded from the internet, but it's very inconvenient since it doesn't match your own apcslib's contents (for example, it doesn't have FileInput). By the way, I've also tried adding the JARS directly to the Java Extensions instead of importing them as external JARS, but that doesn't solve the problem. I've also attached the apcslib.jar in case you think that it's somehow corrupted or something....
    Do you have any idea about what could be wrong or where I should go from here?
    Thanks for all your help!
    Bryan Huh

    Thanks for the reply, but if it is a problem with how
    I'm using DrawingTool, then shouldn't it run with
    errors on my Windows comp too?Maybe, maybe not. If you're doing something that's correct on one but not the other - using file names for Windows on Linux Mac), for instance.
    The same EXACT source
    code will compile and run fine on my Windows comp,
    but run with errors on my Macbook. And if it's a bug
    with DrawingTool, then shouldn't my Windows comp also
    encounter the problem and run with errors?No. the DT programmer could have done the same thing, using code that's correct on Windows but not on Linux. Or there could be a difference in the Java versions on the couputers and code that's valid in the later version is failing in the earlier, or vice versa.

  • Problem with java versions

    I have this project that I was building with Visual SlickEdit and an ant script using java 1.4. I could run the project with no problems...
    However, I am now trying to use netbeans instead of VSS, with the same ant script. But, now when i go to run, I get this error...
      [echo] Executing QTF XML suite....
    [xml.suite] Running com.qualcomm.qtf.xml.XMLTestExecutor
    [xml.suite] java.lang.UnsupportedClassVersionError: com/qualcomm/qtf/xml/XMLTestExecutor (Unsupported major.minor version 49.0)
    [xml.suite]      at java.lang.ClassLoader.defineClass0(Native Method)
    [xml.suite]      at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    [xml.suite]      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    [xml.suite]      at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    [xml.suite]      at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    [xml.suite]      at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    [xml.suite]      at java.security.AccessController.doPrivileged(Native Method)
    [xml.suite]      at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    [xml.suite]      at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    [xml.suite]      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    [xml.suite]      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    [xml.suite]      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    [xml.suite]      at java.lang.Class.forName0(Native Method)
    [xml.suite]      at java.lang.Class.forName(Class.java:141)
    [xml.suite]      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:204)
    [xml.suite]      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:177)
    [xml.suite]      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:651)
    [xml.suite]      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558)
    [xml.suite] Exception in thread "main" How is netbeans changing my java version? Or what is it doing to cause this incompatibility?

    The stack crawl indicates that ant is attempting to dynamically load a class that it can't find (named com.qualcomm.qtf.xml.XMLTestExecutor). My guess is that you have not set the classpath properly in NetBeans.
    type Ctrl-1, then Right click on your project, choose Properties and in the Project Properties window check under the Libraries branch.

  • Problem with java swing button and loop

    Problem with java swing button and loop
    I�m using VAJ 4.0. and I�m doing normal GUI application. I have next problem.
    I have in the same class two jswing buttons named start (ivjGStart) and stop (ivjGStop) and private static int field named Status where initial value is 0. This buttons should work something like this:
    When I click on start button it must do next:
    Start button must set disenabled and Stop button must set enabled and selected. Field status is set to 1, because this is a condition in next procedure in some loop. And then procedure named IzvajajNeprekinjeno() is invoked.
    And when I click on stop button it must do next:
    Start button must set enabled and selected and Stop button must set disenabled.
    Field status is set to 0.
    This works everything fine without loop �do .. while� inside the procedure IzvajajNeprekinjeno(). But when used this loop the start button all the time stay (like) pressed. And this means that a can�t stop my loop.
    There is java code, so you can get better picture:
    /** start button */
    public void gStart_ActionEvents() {
    try {
    ivjGStart.setEnabled(false);
    ivjGStop.setEnabled(true);
    ivjGStop.setSelected(true);
    getJTextPane1().setText("Program is running ...");
    Status = 1;
    } catch (Exception e) {}
    /** stop button */
    public void gStop_ActionEvents() {
    try {
    ivjGStart.setEnabled(true);
    ivjGStart.setSelected(true);
    ivjGStop.setEnabled(false);
    getJTextPane1().setText("Program is NOT running ...");
    Status = 0;
    } catch (Exception e) {
    /** procedure IzvajajNeprekinjeno() */
    public void IzvajajNeprekinjeno() {  //RunLoop
    try {
    int zamik = 2000; //delay
    do {
    Thread.sleep(zamik);
    PreberiDat(); //procedure
    } while (Status == 1);
    } catch (Exception e) {
    So, I'm asking what I have to do, that start button will not all the time stay pressed? Or some other aspect of solving this problem.
    Any help will be appreciated.
    Best regards,
    Tomi

    This is a multi thread problem. When you start the gui, it is running in one thread. Lets call that GUI_Thread so we know what we are talking about.
    Since java is task-based this will happen if you do like this:
    1. Button "Start" is pressed. Thread running: GUI_Thread
    2. Event gStart_ActionEvents() called. Thread running: GUI_Thread
    3. Method IzvajajNeprekinjeno() called. Thread running: GUI_Thread
    4. Sleep in method IzvajajNeprekinjeno() on thread GUI_Thread
    5. Call PreberiDat(). Thread running: GUI_Thread
    6. Check status. If == 1, go tho 4. Thread running: GUI_Thread.
    Since the method IzvajajNeprekinjeno() (what does that mean?) and the GUI is running in the same thread and the event that the Start button has thrown isn't done yet, the program will go on in the IzvajajNeprekinjeno() method forever and never let you press the Stop-button.
    What you have to do is do put either the GUI in a thread of its own or start a new thread that will do the task of the IzvajajNeprekinjeno() method.
    http://java.sun.com/docs/books/tutorial/uiswing/index.html
    This tutorial explains how to build a multi threaded gui.
    /Lime

  • A Problem with java

    I have a question with the program.I have write a program that it about polynomial which is in order to desc. But my teacher want me to modify the program to in order to asc. But I don't have any idea with that. Can anyone give me some ideas for this. How can I modify it by easy method? The code is about that,
    public class Polynomial
        private int degree;
        private Node head;
        public static Polynomial addPolys(Polynomial poly1, Polynomial poly2)
            Polynomial polyRes = new Polynomial();
            int power = (poly1.degree > poly2.degree) ? poly1.degree : poly2.degree;
            while (power >= 0)
                Node n1 = poly1.head;
                while (n1 != null)
                    if (n1.power == power)
                        break;
                    n1 = n1.next;
                Node n2 = poly2.head;
                while (n2 != null)
                    if (n2.power == power)
                        break;
                    n2 = n2.next;
                if ((n1 != null) && (n2 != null))
                    polyRes.addNode(n1.coeff + n2.coeff, n1.power);
                else if (n1 != null)
                    polyRes.addNode(n1.coeff, n1.power);
                else if (n2 != null)
                    polyRes.addNode(n2.coeff, n2.power);
                power--;
            return polyRes;       
        public void addNode(int coeff, int power)
            if (head == null)
                head = new Node(coeff, power, null);
                degree = power;
            else
                Node n = head;
                Node last = null;
                while (n != null)
                    if (power > n.power)
                        if (last == null)
                            head = new Node(coeff, power, n);
                        else
                            last.next = new Node(coeff, power, n);
                        degree = power;
                        break;
                    last = n;
                    n = n.next;
                if (n == null)
                    last.next = new Node(coeff, power, null);
        public class Node
            public int coeff;
            public int power;
            public Node next;
            public Node(int coeff, int power, Node next)
                this.coeff = coeff;
                this.power = power;
                this.next = next;
        public String toString()
            StringBuffer strBuf = new StringBuffer();
            Node n = head;
            while (n != null)
                if (n.coeff >= 0)
                    strBuf.append("+ ").append(n.coeff);
                else
                    strBuf.append("- ").append(-(n.coeff));
                if (n.power > 1)
                    strBuf.append("x^").append(n.power);
                else if (n.power == 1)
                    strBuf.append("x");
                strBuf.append("  ");
                n = n.next;
            return strBuf.toString();
    }

    In the future, please use a meaningful subject. "A Problem with Java" contains no information, since by the very fact that you're posting here, it's obvious that you're having a problem with Java. The subject line should give a high level overview of what kind of problem you're having, so people can decide if they're interested and qualified to answer.

Maybe you are looking for

  • Capture problem: no video

    I'm trying to capture a video clip to FCP and I'm getting the following error: "This operation could not be completed as there is no video." The Log & Capture window shows color bars, with "Preview Disabled" over-printed. Nonetheless, the vcr control

  • ALERT: 8.1.7.1 Upgrade Overwrites iAS OWA

    I'm poting the following for those of who who don't have access to Metalink (let me know if I'm not supposed to do this) and because I have an issue with what it says: Doc ID: Note:143368.1 Subject: ALERT: 8.1.7.1 Upgrade Overwrites iAS OWA Packages

  • How to get the; popular tag: back in safari. Deleted it.

    How to get the POPULAR tab back in safari after deleting it. Thanks for the help.

  • Firefox Freezes

    Whenever I try to open websites with videos, such as www.tudou.com and www.vyouku.com, firefox freezes. Regardless of how many times I reload firefox, the same problem occurs and I always have to switch to IE when I want to watch a video :( Although

  • Error: Could not open key: UNKNOWN\Components in Windows Server 2012 R2

    Hi, I am trying to install an MSI where i am getting the below error  ..\MSI\CHIP_MAPS.msi: Could not open key: UNKNOWN\Components\F5C1BE1268054884D9261E148691452A\34DBF3FA04D67B443A8EE069E02E418B.   Verify that you have sufficient access to that key