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 8945035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:09:28+00:00 2026-06-15T12:09:28+00:00

My file name is Temp.java and inside it I have this. I’m using eclipse

  • 0

My file name is Temp.java and inside it I have this. I’m using eclipse IDE

/*package*/ class Test {
    public static void main(String args[]) {
        System.out.println("test");
    }
}

So I was unable to run this as java application. I change my class name to Temp

class Temp {
 ....
}

Now I can. Can someone explain me why ?

  • 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-15T12:09:29+00:00Added an answer on June 15, 2026 at 12:09 pm

    This is probably a limitation of Eclipse. The code runs well from command line.

    As I understand, you are trying to embed your unit tests in the same file with the class under test. This is a nice idea and I totally concur with it. You can read more about how you can succeed in Ben J. Christensen’s blog post. Generally, he suggests placing the tests in a static inner class, not a standalone class in the same file.

    An example from the Netflix Hystrix framework: HystrixCircuitBreaker.UnitTest

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

Sidebar

Related Questions

I've a problem of downloading arabic attachment files using java mail. The file name
The file name only coming when saving the exported file, how can we have
I have a file name dayhappy_02_02345.csv How do I get the 02 part out
i have a file name that contains spaces: bw3 - Copy_1340627264571.jpg and i use
I have a file name logspath.txt which contain on the logs directory path on
This question asks about file name the servers sends and the fix was quite
I need html - java script / jquery charts using single file. What do
In my Java Spring web app I am creating an image file. This file
I have a bit of Java code that outputs an XML file to a
When I start my application I create a temp folder: public static File createTempDir(String

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.