Forums Register Login

classpath in dtdparser

+Pie Number of slices to send: Send
I am trying to work with dtdparser but i have two questions
First: how to compile a file
i am trying to change in tokenize file that is given and i am using the following command to compile it using javac -classpath dtdparser121.jar com.wutka.dtd.Tokenize.java but it is not working
Second:
i Do not understand the meaning of
java -classpath dtdparser121.jar com.wutka.dtd.Tokenize example1.dtd
i mean what if i want to run another class file what shall i write

Maha
+Pie Number of slices to send: Send
I'll move this over to the Java in General forum because it's not really about the "dtdparser" but, well, Java in general...
+Pie Number of slices to send: Send
 

Originally posted by Maha Hassan:
how to compile a file
i am trying to change in tokenize file that is given and i am using the following command to compile it using javac -classpath dtdparser121.jar com.wutka.dtd.Tokenize.java but it is not working


The javac command's syntax is roughly this:

javac [options] [source files]

One of the supported options is "-classpath", which you defined as "dtdparser121.jar" (and because it's a relative path, javac will expect to find dtdparser121.jar in the current working directory). Now, the source files need to be specified using your operating system's file paths, not using the Java package syntax. I.e. instead of "com.wutka.dtd.Tokenize.java", use "com/wutka/dtd/Tokenize.java". Again, this assumes that you're running the command from the root of the source directory. If you're not there, then you need to use something like "javac ... c:\book_code\src\com\wutka\dtd\Tokenize.java".

Originally posted by Maha Hassan:
i Do not understand the meaning of
java -classpath dtdparser121.jar com.wutka.dtd.Tokenize example1.dtd
i mean what if i want to run another class file what shall i write


The syntax of the java command is roughly:

java [options] [class name] [arguments]

Which means that your example above says "I want to invoke a new JVM, which has dtdparser121.jar as its classpath, and I want it to invoke the main() method on a class named 'com.wutka.dtd.Tokenize', and I want to pass the string 'example1.dtd' as the only argument to the main() method."
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 721 times.
Similar Threads
What *.jar has this class?
I can not find the class file
Where is com.sun.xml.tree??
I still can't do this
Ant Run error: duplicacy of java file in different jar
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:02:47.