jjacksn
asked on
SIMPLE: help executing basic java command
I have been using IDEs for way too long... i can't execute a class
I am in mydir
in mydir is build
in build is
org/demo/myproduct
in myproduct is myclass with a main method
whne I'm in mydir, i am running
java -cp build org.demo.myproduct.myclass
but getting a no class def error, what am i doing wrong?
I am in mydir
in mydir is build
in build is
org/demo/myproduct
in myproduct is myclass with a main method
whne I'm in mydir, i am running
java -cp build org.demo.myproduct.myclass
but getting a no class def error, what am i doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
jf - that doesn't not work, does it need to be qualified?
ok, if I go into build, this works
java -cp . org/demo/myproduct/myclass
however, i'm executing in ANT, and my basedir is in the parent directory of build. so how do I set my class path?
ok, if I go into build, this works
java -cp . org/demo/myproduct/myclass
however, i'm executing in ANT, and my basedir is in the parent directory of build. so how do I set my class path?
ASKER
yeah, I don't know what was happening before, that does work from the command line.
however, in ANT i have:
<target name="create-keys">
<java classname = "org.sharedrecords.demo.Ke yStoreGene rator">
<arg value = "build/org/sharedrecords/d emo/utils" />
<classpath path="build"/>
</java>
</target>
and it doesn't work.
however, in ANT i have:
<target name="create-keys">
<java classname = "org.sharedrecords.demo.Ke
<arg value = "build/org/sharedrecords/d
<classpath path="build"/>
</java>
</target>
and it doesn't work.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
still no luck. Is there someway i can turn verbose mode on while running from eclipse?
ASKER
i ran it from the command line... didn't see anything useful. just "could not find org.sharedrecords.demo.Key StoreGener ator"
> and my basedir is in the parent directory of build.
are you sure thats the case? try settting the dir attribute for the java task
are you sure thats the case? try settting the dir attribute for the java task
ASKER
i used dir = "${basedire}"
a got this message [java] Working directory ignored when same JVM is used.
a got this message [java] Working directory ignored when same JVM is used.
run ant with -verbose and see what that tells you.
ASKER
wow, so, as it turns out, suprisingly enough, KeySTOREGenerator != KeyPAIRGenerator. that was fun.
:-)
In the command line, navigate to mydir. Then you can either navigate to the folder with the files, or just type:
java build/org/demo/myproduct/m
It might be easier to navigate to the actual folder though. From mydir:
cd build
cd org
cd demo
cd myproduct
java myclass