| Author |
How do I use a path as an argument without breaking the -classpath option?
|
Todd Patrick
Ranch Hand
Joined: Jan 30, 2004
Posts: 31
|
|
[Specs.] SUN Solaris java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode) [Question.] How do I use a path as an argument without breaking the -classpath option? I have the following Korn Shell Script: When I run the shell script, I return the following error: Exception in thread "main" java.lang.NoClassDefFoundError: /EAIStorageNumbers/v1/0001/weekly05222006/csv Thus, the -classpath option sees the first argument as a classpath. When I remove the -classpath option, I get a different error, which is another issue: Exception in thread "main" java.lang.NoClassDefFoundError: au/com/bytecode/opencsv/CSVReader at com.dtn.refinedfuels.EAIStorageNumbers.main(Unknown Source) Thoughts or suggestions on how I can get the -classpath option to work with the defined Korn Shell Script variables would be greatly appreciated. Thanks,
|
--Todd
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8291
|
|
|
As Carl explained in your previous post, the -classpath argument is supposed to be followed by a list of directories or archives where the JVM can find the classes it needs. There's no shortage of guides to how the classpath works, including our faq and the JVM Release Notes.
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
Todd Patrick
Ranch Hand
Joined: Jan 30, 2004
Posts: 31
|
|
Joe: I understand that. I've read the faq. "com.dtn.refinedfuels.EAIStorageNumbers" is the class file in the package "com.dtn.refinedfuels" That why I did a cd to the directory "/EAIStorageNumbers/v1/bin/" which holds the package prior to executing the class. I just don't understand why an argument would be looked at as a -classpath option when I've followed the rules: java [-options] class [args...] From my Korn shell script, how would you set up the execute class line? Thanks,
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
-classpath interprets the next thing on the command line as its argument; in your case, it's the class name. Then the next thing after that is interpreted as the class name; this is the first argument to your program. The point is that you cannot say "java -classpath ClassName". You must say "java -classpath PATH ClassName". I don't even understand what you're trying to do by using -classpath without its PATH argument -- can you explain?
|
[Jess in Action][AskingGoodQuestions]
|
 |
Todd Patrick
Ranch Hand
Joined: Jan 30, 2004
Posts: 31
|
|
My sincere apologies, yes - I was missing the PATH value for the -classpath option. My execute class line is now: "Thank you for setting me straight!" [ May 23, 2006: Message edited by: Todd Patrick ]
|
 |
 |
|
|
subject: How do I use a path as an argument without breaking the -classpath option?
|
|
|