Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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
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
Report Offensive Follow Up For Removal
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?
Report Offensive Follow Up For Removal
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
Report Offensive Follow Up For Removal
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
Report Offensive Follow Up For Removal
![]() |
![]() |
![]() |

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