Hi guys - kinda wierd issue i'm having.

I have a java source file called in a folder called program (just in windows) has like 8 or 9 classes in it plus one class called with the main( ) method.

I want all these class files to be part of a package called utilstuff

At the "beggining" of source code file i type (on the first line)
package utilstuff;

Now I compile it. In my program folder I see the file, and a folder calld utilstuff, with all my class files in it - just fine.
So compiles fine.

When i go to run it - it gives me an error
Exception in thread "main" java.lang.NoSuchMethodError: main
Press any key to continue...

Without the package statement it compiles and runs just fine.

Thanks kindly
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

how do u run it? should be something like:

java utilstuff.Start
pauldhadiallaAuthor Commented:
objects - the class file which contains the main method is called - so I go javac to compile it and then java Start to run it
you need to specify the fully qualified classname to run class ie. you need to include the package name

java utilstuff.Start
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

also when u want to compile java from different packages like
under which some 10 classes
under which some classes..
At that time if u want to compile
javac -d . *.java
 thats means -d for package options and . for put the classes in the current directory or u can specify the path u want to put.

so if u runnig this commond in the currrent directory say c:/temp

under c:/temp u can see a new folder created com/test1/*.class and com/test2/*.class files

so if u want to run..
what objects said the same the class which has main method
java com.test1 xxx
or java com.test2 YYY
or java com.test2.YYY
Better download IDE it will do for u...
u can go  for
its free only
pauldhadiallaAuthor Commented:
Hi guys. Still getting the same issue. hmmm

I have my main sitting in a folder called  'program' (doesn't really matter what its called, its just on windows in this folder - nothing else in there)

At the top of the package it says:
package utilstuff;

I compile it - it compiles - creates a folder called utilstuff inside the program folder.

Now i go into the dos prompt and from the program folder run utilstuff.Start  AND also tried going into utilstuff folder and running Start from there.

Still something fishy.

I wonder if i have something with 'access' modifiers messed up - should all the classes have public methods only - and what about variables

Thanks kindly
u better post your code
download eclipse it will automatically configure ..
just create a new class and press the run will compile and run for u..
try this

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.