Computing.Net > Forums > Programming > specifying a java classpath

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

specifying a java classpath

Reply to Message Icon

Name: Asaf Vizner
Date: April 25, 2007 at 00:00:13 Pacific
OS: Windows 2000 pro
CPU/Ram: Intel(R) pentium4 3.00GH
Comment:

Hello
I'm trying to run a java application from command line:
java -classpath "G:\Viqee\classes;G:\Viqee\jar" "com.nextnine.common.Application"
The problem is that the java compiler recognise only a part of the classpath,
i.e. only the classes from G:\Viqee\classes are recognized by java and all the jars from G:\Viqee\jar are ignored.
I can tell that from two reasons:
1.) the exceptions that I get from java indicates that the jars are missing.
2.) when I add the jars one by one to the classpath it's working.
if anyone have any idea please replay to me.
thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Guy
Date: April 25, 2007 at 14:46:51 Pacific
Reply:

I do not actually see a JAR file name in that classpath, it looks like a directory name.

JARs are specified by using the full file name, like:

-classpath G:\x\classes;G:\x\jars\someapplication.jar



0

Response Number 2
Name: Asaf Vizner
Date: April 25, 2007 at 21:42:38 Pacific
Reply:

Thanks for responding.
The point is that the directory G:\Viqee\jar contains multiple jars and I would like to include all the jars in my classpaht and by specifying a full file name for each jar I get a very long command which the console can't handle.
so I would like to create a shorter command which will include all the jars by specifying only the directory name.
can it be done?


0

Response Number 3
Name: Guy
Date: April 26, 2007 at 14:16:54 Pacific
Reply:

Google tells me that cmd.exe handles a max line length of 8192. There must be a lot of JARs in that directory.

If your console cannot handle the length, perhaps you are using the wrong OS. :-)

I don't have a Windows box here, but someone will correct me if I get this .BAT stuff wrong. FWIW, here is an idea which we use at work to make building a list of JARs easier:

set CLASSPATH=
for %%i in ("C:\jars\*.jar") do call :addjar %%i
goto :eof
:addjar
set CLASSPATH=%1;%CLASSPATH%
goto :eof



0

Response Number 4
Name: Asaf Vizner
Date: April 28, 2007 at 22:28:29 Pacific
Reply:

Thanks man it's really working. :-)

about the OS, I'm really don't have a lot of space for maneuvering here, IMO this is a basic requirement which every OS /jdk /jre should be able to handle.
my directory contains a large number of jars (about 60) and I only expected java to allow me include the entire directory in the classpath without specifying each one of them.
anyway thanks again
Asaf


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: specifying a java classpath

loading a java class from matlab www.computing.net/answers/programming/loading-a-java-class-from-matlab/13739.html

Java CLASSPATH www.computing.net/answers/programming/java-classpath/988.html

clickable link in a java applet www.computing.net/answers/programming/clickable-link-in-a-java-applet/12735.html