aspose file tools*
The moose likes Java in General and the fly likes HELP with classpath please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "HELP with classpath please" Watch "HELP with classpath please" New topic
Author

HELP with classpath please

Gustavo Santos
Ranch Hand

Joined: Jan 22, 2009
Posts: 40
Hi everyone,

I'm having a big issue on attempting to run my class through command line, here's what is going on.

I have all the necessary libraries in the same directory as my class file, so what I do is:

javac NovoTestGet.java

then,

java NovoTestGet

and I get the following:



I really wish someone could help me out on this one,

Regards.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You've probably got the CLASSPATH environment variable set, but it's set to a value that doesn't include "." (dot), the current directory. The best thing to do is unset the CLASSPATH variable, and use the default, which is, in fact, ".". But you can also specify the class path on the command like:

java -classpath . NovoTestGet

(That's java space dash classpath space period space NovoTestGet).


[Jess in Action][AskingGoodQuestions]
Gustavo Santos
Ranch Hand

Joined: Jan 22, 2009
Posts: 40
Ernest Friedman-Hill wrote:You've probably got the CLASSPATH environment variable set, but it's set to a value that doesn't include "." (dot), the current directory. The best thing to do is unset the CLASSPATH variable, and use the default, which is, in fact, ".". But you can also specify the class path on the command like:

java -classpath . NovoTestGet

(That's java space dash classpath space period space NovoTestGet).


Thank you so much for the quick reply, but unfortunately I still got that error... I did just what you said, set the environment variable as ".", and I got all the jars I need to run it in the same directory of my java class, so I did:

java -cp . NovoTestGet

and still didn't work... then I tried:

java -cp .:commons-httpclient-3.0-rc4.jar:commons-codec-1.3.jar:commons-logging.jar NovoTestGet

but nothing

any other hint?

Regards.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Is your class in a package?

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Is there a class named NovoTestGet in NovoTestGet.java ?

If you ask for a file listing of the current directory (i.e., "dir" on Windows, or "ls" on an actual computer) do you see NovoTestGet.class ?
Gustavo Santos
Ranch Hand

Joined: Jan 22, 2009
Posts: 40
Henry Wong wrote:Is your class in a package?

No it's not. here's my java file, and the jars are in the same directory as my class file:

Gustavo Santos
Ranch Hand

Joined: Jan 22, 2009
Posts: 40
Ernest Friedman-Hill wrote:Is there a class named NovoTestGet in NovoTestGet.java ?

If you ask for a file listing of the current directory (i.e., "dir" on Windows, or "ls" on an actual computer) do you see NovoTestGet.class ?


Yes, I do.

16/10/2009 10:42 <DIR> .
16/10/2009 10:42 <DIR> ..
10/07/2004 17:13 46.725 commons-codec-1.3.jar
10/10/2005 23:08 278.799 commons-httpclient-3.0-rc4.jar
23/07/2004 14:14 31.605 commons-logging.jar
16/10/2009 10:41 1.592 NovoTestGet.class
16/10/2009 10:40 1.116 NovoTestGet.java
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
Gustavo Santos wrote:
java -cp .:commons-httpclient-3.0-rc4.jar:commons-codec-1.3.jar:commons-logging.jar NovoTestGet

So you're not on Windows? I'm asking because Windows uses semicolons for the classpath delimiter, not colons.


Ping & DNS - my free Android networking tools app
Gustavo Santos
Ranch Hand

Joined: Jan 22, 2009
Posts: 40
Ulf Dittmer wrote:
Gustavo Santos wrote:
java -cp .:commons-httpclient-3.0-rc4.jar:commons-codec-1.3.jar:commons-logging.jar NovoTestGet

So you're not on Windows? I'm asking because Windows uses semicolons for the classpath delimiter, not colons.


Yes! I GOT it! thank you guys for your help! I just needed to change the ":" with ";" ... didn't know the difference between both, very silly.

Many thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HELP with classpath please