java code working only with default package

Hi,

I have created a class in the package

issuecom.anshu.biautomation.tabcmd

The class is called Tableaucmdautomation

it works fine from eclipse but when I try to execute it from command line then I get main class not found error

I have tried all the options of giving explicit classpath in the command line etc

So I tried one more thing , create the file without a package and then it works fine in the folder I have class file

to follow the best practice I want to stick to packages but I need to make sure that I can execute it from command lines as well.

What am I doing wrong here ?

PS: when I remove it from the package and put it in the default package. Then it works fine
anshumaEngineeringAsked:
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.

Amitkumar PSr. ConsultantCommented:
I gone thru snap provided by you. Follow below steps..

1. Goto c:\eclipse\workspace\test\bin dir.
2. Then run java -cp .; com.anshu.biautomation.tabcmd.Tableaucmdautomation

Basically, when we need to run class residing in a packge, we will have to provide entire package structure. Give it a try as suggested above and share the result.
0
gurpsbassiCommented:
I would rename your class to something more appropriate. The current name is rubbish.
0
anshumaEngineeringAuthor Commented:
Hi amit,

Your help has resolved the issue

@gurpsbassi

can you please give me an example of a more appropriate name
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

gurpsbassiCommented:
I would need to know more about the role of the class i.e. what does it do?

Also you need to learn about using camel case in class naming.
0
Amitkumar PSr. ConsultantCommented:
Agree with gurpsbassi about naming convention.

Assuming that Tableaucmdautomation is for simple class for Tableau (similar to HelloWorld) for automation. If so, I would use below for package and class.

Package : com.anshu.automation.command.
Class : TableauCommand

You need to name it as per the job the class does and that is why gurpsbassi asked for the responsibility of your class.

Refer below links for more on naming standards.

http://www.oracle.com/technetwork/java/codeconventions-135099.html
http://java.about.com/od/javasyntax/a/nameconventions.htm (hope this is a valid to post on EE)
0

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
anshumaEngineeringAuthor Commented:
The logic for this is

com.anshu ( i will have the name of the company)

.biautomation (stands for business intelligence automation)

.tabcmd (stands for tableau command manager) similalrly we can have one for Microstrategy (mstrcmd)

.Tableaucmdautomation this shows that this is the actual class that does automation specifically for triggering reports , other classes can be created for doing other automation work on tableau (may be adding tableau to this name is redundant)
0
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
Java

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.