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

  • Home
  • SEARCH
  • 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 3670040
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:18:57+00:00 2026-05-19T02:18:57+00:00

Recently when I write any code and compile it, then try to run it

  • 0

Recently when I write any code and compile it, then try to run it I get this exception:

Exception in thread “main” java.lang.NoSuchMethodError

At first I thought there is something wrong in my code, but I couldn’t find anything wrong with it. When trying to run a HelloWorld example that had worked before, if works, but if I copy the exact same code into a file HelloWorld2 I get this exception again.

The code is identical but when I used javap to decompile both class files I found a difference. In HelloWorld (the original file)

"public static void main(java.lang.String[])";

and in HelloWorld2 (the new one)

"public static void main(String[])";

without java.lang..

I recompiled the old HelloWorld with javac and now when I try to run it it doesn’t work and I get the same exception. None of my old code now works if I recompile it.

I’ve searched everywhere but can’t find a solution to this problem – any idea what is going on here?

  • 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-05-19T02:18:58+00:00Added an answer on May 19, 2026 at 2:18 am

    You may get this if you have your own class called String (without a package) in your classpath. It sounds like that’s what happened. Here’s a way to try to reproduce this – compile it and run it, and see if it looks the same:

    class String {} 
    
    public class Test {
        public static void main(String[] args) {
        }    
    }
    

    Once you’ve got the compiled String.class file in your file system in an awkward place, that will be used by default even if you only compile the Test class above…

    Basically, see if you can find a file called String.class somewhere.

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

Sidebar

Related Questions

I'm an avid vim user and have started to write some SQL code recently.
I occasionally write code something like this: // file1.cpp #define DO_THIS 1 #if DO_THIS
Recently, Lee Baldwin showed how to write a generic, variable argument memoize function .
Recently I have been studying recursion; how to write it, analyze it, etc. I
Recently, I found myself having to write up some concerns I have about race
Have had to write my first proper multithreaded coded recently, and realised just how
I recently wrote some javascript code that filled a drop down list based on
I recently wrote a piece of code which did SomeClass someObject; mysqlpp::StoreQueryResult result =
Recently the security team on my project released a secure code guidelines document, designed
I recently wrote a parser in Python using Ply (it's a python reimplementation of

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.