Length limit on CLASSPATH setting (JIntegra's regjvmcmd)

P

Prabh

Hello all,
When running cmds which set the CLASSPATH on WIN, is there any
upper-limit on the length of the CLASSPATH value string?

From WIN XP, I'm running JIntegra's regjvmcmd as follows,

==============================================================================
regjvmcmd /native /inproc /java2 Foojvm
classpath="C:\Progra~1\AppFolder\lib\First.jar
....<whole-bunch-of-jars>" jvm="c:\program
files\java\j2re1.4.2\bin\client\jvm.dll"
main=com.jintegra.setup.MainClass -Djintegra.jvm=Foojvm
-DJINTEGRA_NATIVE_MODE
==============================================================================

When the CLASSPATH is reasonably short the regjvmcmd works fine, but
when its really long, I dont see the CLASSPATH set for the FooJVM.

Could anyone give me some pointers, please?
Is this related more to Windows?

Thanks,
Prabh
 
K

Ken Kafieh

I can tell you that I have personally seen the value of CLASSPATH and other
environment variables truncated.
You may be forced to either shorten paths, or choose between the most
important paths. At least, thats what I did
another thing you may want to do is get rid of the LFNs and convert the path
names to 8Dot3 format. For example, use

C:\PROGRA~1

instead of

"C:\PROGRAM FILES"

-Ken
 
T

Tony Morris

When the CLASSPATH is reasonably short the regjvmcmd works fine, but
when its really long, I dont see the CLASSPATH set for the FooJVM.

Could anyone give me some pointers, please?
Is this related more to Windows?

Yes there is a limit to the length of the CLASSPATH, since there is a limit
to the length of an executable command on Windows.
I've encountered this limit before (by attempting to set a long CLASPATH),
but I couldn't tell you exactly what it is (Google prolly will).

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
 
P

Prabh

Roedy Green said:
IIRC Win98 has a limit of 255. It may be higher for other or 4NT.

You can pare in down by putting jars in the ext directory.

see http://mindprod.com/jgloss/classpath.html




Thanks a lot everybody for your responses.

I do have a question with the ext directory approach, however.
If I understand the ext mechanism right, I'd need to install all my
jars in <JRE>\lib\ext location of user's PC.

1. Would it not be an issue if there are two jars with identical name?

2. I guess, I could make an effort not to install two
identically-named jars, but what if the user installs some other
product which too installs to
the ext dir and has a similarly named jar as mine.

Thanks,
Prab
 
M

Michael Rauscher

Prabh schrieb:
[...]
I do have a question with the ext directory approach, however.
If I understand the ext mechanism right, I'd need to install all my
jars in <JRE>\lib\ext location of user's PC.

Don't put files into the ext directory.

IMO, the ext directory is superfluous and makes more problems than it
solves.
1. Would it not be an issue if there are two jars with identical name?

You cannot have two files with identical name within the same directory.
2. I guess, I could make an effort not to install two
identically-named jars, but what if the user installs some other
product which too installs to
the ext dir and has a similarly named jar as mine.

Then, yours is gone.

But there are a more problems with the ext directory. Assume you have
two applications and both use the same library, called NeededLib. The
first application relies on version 1.3, the second on version 2. And now?

Of course, you can rename the files, e.g. to neededlib1_3.jar and
neededlib2.jar. But both jars contains (more or less) the same classes.
And now?

Perhaps one can solve these ambiguities using versioning information
(this requires that the package includes versioning information).

And now? Now, you've dealt with many problems and you've done a lot of
work, just because one wanted to see his jar inside the ext directory.

Bye
Michael
 
R

Roedy Green

I do have a question with the ext directory approach, however.
If I understand the ext mechanism right, I'd need to install all my
jars in <JRE>\lib\ext location of user's PC.

1. Would it not be an issue if there are two jars with identical name?

2. I guess, I could make an effort not to install two
identically-named jars, but what if the user installs some other
product which too installs to
the ext dir and has a similarly named jar as mine.

There are two ext directories. I put them in both. I use a bat file
like this every time I change JVMs.


rem fixext.btm fix the ext directories for Java

@echo off
set target1="E:\j2sdk1.4.2_04\jre\lib\ext"
set target2="C:\Program Files\Java\j2re1.4.2_04\lib\ext"
set
echo.
echo Check that sets look plausible
pause
rem 4NT requires ( and ) to be on different lines than contents, Note
no & and no \
for %target in ( %target1 %target2 ) do (

cdd %target

copy "C:\Program Files\JMF2.1.1e\lib\jmf.jar"
copy "C:\Program Files\JMF2.1.1e\lib\sound.jar"
copy "C:\jaf-1.0.2\activation.jar"
copy "C:\javamail-1.3\mail.jar"
copy "E:\j2sdk1.4.2_04\jre\javaws\javaws.jar"
)
echo.
echo check that copies all worked.
pause

echo.
echo.
echo jikespath should be:
echo e:\j2sdk1.4.2_04\jre\lib\rt.jar;.;C:\;E:\;C:\Program
Files\JMF2.1.1e\lib;C:\WINNT\java\classes
echo.
echo it is:
echo %Jikespath%
echo.
echo.
echo classpath should be:
echo .;C:\;E:\;C:\Program Files\JMF2.1.1e\lib;C:\WINNT\java\classes
echo.
echo it is
echo %classpath%
echo.
echo.
echo path should be:
echo
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;E:\Program
Files\Panda Software\Panda Antivirus
Platinum;E:\JET\bin;E:\VSLICK\WIN;e:\J2SDK1.4.2_04\BIN;C:\env;c:\bat\;c:\sys;C:\Program
Files\Common Files\Adaptec Shared\System
echo E:\Program Files\Microsoft Visual
Studio\Common\Tools\WinNT;E:\Program Files\Microsoft Visual
Studio\Common\MSDev98\Bin;E:\Program Files\Microsoft Visual
Studio\Common\Tools;E:\Program Files\Microsoft Visual Studio\VC98\bin
echo.
echo it is:
echo %path%
pause

rem -30-
 
R

Roedy Green

1. Would it not be an issue if there are two jars with identical name?

Just rename one jar. The java does not care about the jar name, only
the class name.
 
R

Roedy Green

2. I guess, I could make an effort not to install two
identically-named jars, but what if the user installs some other
product which too installs to
the ext dir and has a similarly named jar as mine.

Generally products don't change your ext directory without your
permission. They usually fiddle the classpath. It is up to you to undo
the classpath fiddle and copy the jar files.
 
R

Real Gagnon

Liz said:
my classpath is 890 characters long on windows xp

The OP problem is not really the classpath length but the command line
length which is limited to 255 characters.

Bye.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top