Amit
asked on
java code working only with default package
Hi,
I have created a class in the package
com.anshu.biautomation.tab cmd
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
I have created a class in the package
com.anshu.biautomation.tab
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
I would rename your class to something more appropriate. The current name is rubbish.
ASKER
Hi amit,
Your help has resolved the issue
@gurpsbassi
can you please give me an example of a more appropriate name
Your help has resolved the issue
@gurpsbassi
can you please give me an example of a more appropriate name
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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)
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)
1. Goto c:\eclipse\workspace\test\
2. Then run java -cp .; com.anshu.biautomation.tab
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.