Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8034945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:10:06+00:00 2026-06-05T02:10:06+00:00

I have a Timer class and a Test class to test this timer: package

  • 0

I have a Timer class and a Test class to test this timer:

package tools;

public class Timer extends Thread 
{
    public boolean isRunning = true;
    private long timeout = 0;

    public Timer(long aTimeout)
    {
        timeout = aTimeout;
    }

    // Run the Thread
    public void run()
    {
        int i = 1000;
        while(i <= timeout)
        {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            i = i + 1000;
        }
        isRunning = false;
    }
}

And the Test Class:

public class Test 
{
    public static void main(String[] args) 
    {
        Timer myTimer = new Timer(10000);
        myTimer.start();

        while(myTimer.isRunning)
        {
            System.out.println("Running");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
}

In Eclipse this works well. When I include it to another project on a Solaris Server, I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: tools.Timer.<init>(J)V 

I googled it but I could not find any answer – why is this not working ? Cheers, Tim.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:10:08+00:00Added an answer on June 5, 2026 at 2:10 am

    You’re constructing timer like this:

    Timer myTimer = new Timer();
    

    And your constructor declaration is:

    public Timer(long aTimeout)
    

    Obvious, isn’t it? You must either construct the timer like new Timer(1234), or add a parameterless constructor to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this class ('Scheduler.as'): package { import flash.events.TimerEvent; import flash.utils.Timer; public class Scheduler
I have this code: package org.optimization.geneticAlgorithm; import org.optimization.geneticAlgorithm.selection.Pair; public abstract class Chromosome implements Comparable<Chromosome>
i have this timer in c#: public class HomeController : Controller { public int
I have a class Similar to this public class Model { public TimeSpan Time1
i have domain classes: package test class Credit { String name; static hasMany =
I have a static timer class which will be called by ANY webpage to
I have a small class with a timer, but don't have anything for the
Okey, this is my problem. I have one service class where Ive managed to
(This is sort of a long-winded question but I have summarized it at the
I have a no-interface ejb deployed in an ear (MyEar.ear) @Stateless @LocalBean public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.