Re: Running java programs from class files
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 29 Aug 2006 09:45:18 -0700
mark13.pl@xxxxxxxxx wrote:
Hello,
I have created two class: ClassOne & ClassTwo (with main) in MyClass
package. When I run it in eclipse everything goes okay. When I create
jar and choose ClassTwo as Main everything goes okay.
But now I am interested in running it just from class files. What is a
correct syntax for such example?!?
I tried:
"java -classpath . ClassTwo" and similar but never run it getting all
the time: NoClassDefFoundError.
Regards, mark
If your classes are in a package, then you must be in the directory above the package to run from class files. So if you package is called MyPackage, your class file is called MyClass.class and the MyPackage directory is located in /xyz/abc then you must be in /xyz/abc. To execute your program then you must type java MyPackage.MyClass.
--
Knute Johnson
email s/nospam/knute/
.
- Follow-Ups:
- Re: Running java programs from class files
- From: Babu Kalakrishnan
- Re: Running java programs from class files
- References:
- Running java programs from class files
- From: mark13 . pl
- Running java programs from class files
- Prev by Date: Running java programs from class files
- Next by Date: Serving a website based on source internet address
- Previous by thread: Running java programs from class files
- Next by thread: Re: Running java programs from class files
- Index(es):
Relevant Pages
|