• Post Reply Bookmark Topic Watch Topic
  • New Topic

classpath in dtdparser  RSS feed

 
Maha Hassan
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll move this over to the Java in General forum because it's not really about the "dtdparser" but, well, Java in general...
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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."
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!