krishnasaikarthik
asked on
How to Set Java Classpath Size
Dear Experts
Our application classapth contains 100 jar files.
I am running my application by setting the classpath as:
set classpath=jar1;jar2;jar3;. .......... .......;ja r100;
then its giving the error as :
F:\Working\Source\EHR\deve lopmentend \EHR\bin>s et CLASSPATH=F:\Working\Sourc e\EHR\deve lopmentend \EHR\lib\p hysical.ja r;F:\Worki ng\Source\ EHR\develo pmentend\E HR\lib\pro c_diag_cod es.jar;F:\ Working\So urce\EHR\d evelopment end\EHR\li b\vitalsig ns.jar;F:\ Working\So urce\EHR\d evelopment end\EHR\li b\lab_res. jar;F:\Wor king\Sourc e\EHR\deve lopmentend \EHR\lib\l evel_servi ce.jar;F:\ Working\So urce\EHR\d evelopment end\EHR\li b\maps.jar ;F:\Workin g\Source\E HR\develop mentend\EH R\lib\cont rol.jar;F: \Working\S ource\EHR\ devel
opmentend\EHR\lib\hi_att.j ar;F:\Work ing\Source \EHR\devel opmentend\ EHR\lib\in su.jar;F:\ Working\So urce\EHR\d evelopment end\EHR\li b\avalon-f ramework-c vs-2002080 6.jar;F:\W orking\Sou rce\EHR\de velopmente nd\EHR\bin ;F:\Workin g\Source\E HR\develop mentend\EH R\lib\bati k-util.jar ;F:\Workin g\Source\E HR\develop mentend\EH R\lib\bati k.jar;F:\W orking\Sou rce\EHR\de velopmente nd\EHR\lib \xercesImp l.jar;F:\W orking\Sou rce\EHR\de velopmente nd\EHR\lib \xmlParser APIs.jar;F :\Working\ Source\EHR \developme ntend\EHR\ lib\batik- awt-
util.jar;F:\Working\Source \EHR\devel opmentend\ EHR\lib\xm l4j.jar;F: \Working\S ource\EHR\ developmen tend\EHR\l ib\jai_cod ec.jar;F:\ Working\So urce\EHR\d evelopment end\EHR\li b\jai_core .jar;F:\Wo rking\Sour ce\EHR\dev elopmenten d\EHR\lib\ xalan.jar; F:\Working \Source\EH R\developm entend\EHR \lib\commo n_util.jar ;F:\Workin g\Source\E HR\develop mentend\EH R\lib\midd leware_fdb .jar;F:\Wo rking\Sour ce\EHR\dev elopmenten d\EHR\lib\ components _iui_label .jar;F:\Wo rking\Sour ce\EHR\dev elopmenten d\EHR\lib\ images.jar ;F:\Workin g\So
urce\EHR\developmentend\EH R\lib\Comm onClasses. jar;F:\Wor king\Sourc e\EHR\deve lopmentend \EHR\lib\c ryptix.jar ;F:\Workin g\Source\E HR\develop mentend\EH R\lib\reso urces.jar; F:\Working \Source\EH R\developm entend\EHR \lib\sgml. jar;F:\Wor king\Sourc e\EHR\deve lopmentend \EHR\lib\C ommunicati onClasses. jar;F:\Wor king\Sourc e\EHR\deve lopmentend \EHR\lib\i trust.jar; F:\Working \Source\EH R\developm entend\EHR \lib\setti ngs.jar;F: \Working\S ource\EHR\ developmen tend\EHR\l ib\ReadMeP rops.jar;
The input line is too long.
-------------------
its giving the above error and its not starting our application.
i heared that in java default classpath size is 2KB.
how can i set my own classpath size?
is there any way ?
thanks
km
Our application classapth contains 100 jar files.
I am running my application by setting the classpath as:
set classpath=jar1;jar2;jar3;.
then its giving the error as :
F:\Working\Source\EHR\deve
opmentend\EHR\lib\hi_att.j
util.jar;F:\Working\Source
urce\EHR\developmentend\EH
The input line is too long.
-------------------
its giving the above error and its not starting our application.
i heared that in java default classpath size is 2KB.
how can i set my own classpath size?
is there any way ?
thanks
km
>> i heared that in java default classpath size is 2KB.
Not sure, it might also depend on the OS. Try setting the class-path in pieces. Like add 5 JARs to it, then again next 5, and so on. See if it works. Make sure you use "" to enclose the file-path if it contains blank spaces.
Not sure, it might also depend on the OS. Try setting the class-path in pieces. Like add 5 JARs to it, then again next 5, and so on. See if it works. Make sure you use "" to enclose the file-path if it contains blank spaces.
ASKER
hello
if i placed all jars in one jar file, then i am getting the
Exception in thread "main" java.lang.NoClassDefFoundE rror: com/itrust/ariel/client/Lo gon
thanks
km
if i placed all jars in one jar file, then i am getting the
Exception in thread "main" java.lang.NoClassDefFoundE
thanks
km
try something like this:
SET MY_APP_PATH=
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\orac le.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\nlsc harset12.j ar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\jtds .jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\mysq l.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\post gresql.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\jcon nect45.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\db2j cc.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\db2j cc_license _cu.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\db2j ava.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\ifxj dbc.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\jcon nect55.jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\xmlp arserv2.ja r
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\xdb. jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\mail .jar
SET MY_APP_PATH=%MY_APP_PATH%; .\lib\acti vation.jar
java -cp "%MY_APP_PATH%" com.MyApp
create a bat script.....
SET MY_APP_PATH=
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
SET MY_APP_PATH=%MY_APP_PATH%;
java -cp "%MY_APP_PATH%" com.MyApp
create a bat script.....
ASKER
dear mayankeagle,
i changed the classpath as:
set CLASSPATH=%APP_HOME%\lib\i trust.jar; %APP_HOME% \lib\setti ngs.jar;%A PP_HOME%\l ib\ReadMeP rops.jar;
set CLASSPATH=%APP_HOME%\lib\r esources.j ar;%APP_HO ME%\lib\sg ml.jar;%AP P_HOME%\li b\Communic ationClass es.jar;%CL ASSPATH%
set CLASSPATH=%APP_HOME%\lib\i mages.jar; %APP_HOME% \lib\Commo nClasses.j ar;%APP_HO ME%\lib\cr yptix.jar; %CLASSPATH %
set CLASSPATH=%APP_HOME%\lib\c ommon_util .jar;%APP_ HOME%\lib\ middleware _fdb.jar;% APP_HOME%\ lib\compon ents_iui_l abel.jar;% CLASSPATH%
set CLASSPATH=%APP_HOME%\lib\x ml4j.jar;% APP_HOME%\ lib\jai_co dec.jar;%A PP_HOME%\l ib\jai_cor e.jar;%APP _HOME%\lib \xalan.jar ;%CLASSPAT H%
set CLASSPATH=%APP_HOME%\lib\x ercesImpl. jar;%APP_H OME%\lib\x mlParserAP Is.jar;%AP P_HOME%\li b\batik-aw t-util.jar ;%CLASSPAT H%
set CLASSPATH=%APP_HOME%\lib\b atik-util. jar;%APP_H OME%\lib\b atik.jar;% CLASSPATH%
set CLASSPATH=%APP_HOME%\lib\a valon-fram ework-cvs- 20020806.j ar;%APP_HO ME%\bin;%C LASSPATH%
set CLASSPATH=%APP_HOME%\lib\c ontrol.jar ;%APP_HOME %\lib\hi_a tt.jar;%AP P_HOME%\li b\insu.jar ;%CLASSPAT H%
set CLASSPATH=%APP_HOME%\lib\l ab_res.jar ;%APP_HOME %\lib\leve l_service. jar;%APP_H OME%\lib\m aps.jar;%C LASSPATH%
set CLASSPATH=%APP_HOME%\lib\p hysical.ja r;%APP_HOM E%\lib\pro c_diag_cod es.jar;%AP P_HOME%\li b\vitalsig ns.jar;%CL ASSPATH%
set CLASSPATH=%APP_HOME%\lib\L abTests.ja r;%APP_HOM E%\lib\jRe gistryKey. jar;%APP_H OME%\lib\C AG_lib.jar ;%CLASSPAT H%
set CLASSPATH=%APP_HOME%\lib\f op.jar;%AP P_HOME%\li b\itrustpd f.jar;%APP _HOME%\lib \PDF_Class es.jar;%CL ASSPATH%
set CLASSPATH=%APP_HOME%\lib\i text-1.2.j ar;%APP_HO ME%\lib\jR egistryKey .jar;%CLAS SPATH%
still i am getting the same problem.
i am working on Windows2000.
i think in windows the default classpath size is 2kb.
am i right?
how can i set my classpath size?
thanks
km
i changed the classpath as:
set CLASSPATH=%APP_HOME%\lib\i
set CLASSPATH=%APP_HOME%\lib\r
set CLASSPATH=%APP_HOME%\lib\i
set CLASSPATH=%APP_HOME%\lib\c
set CLASSPATH=%APP_HOME%\lib\x
set CLASSPATH=%APP_HOME%\lib\x
set CLASSPATH=%APP_HOME%\lib\b
set CLASSPATH=%APP_HOME%\lib\a
set CLASSPATH=%APP_HOME%\lib\c
set CLASSPATH=%APP_HOME%\lib\l
set CLASSPATH=%APP_HOME%\lib\p
set CLASSPATH=%APP_HOME%\lib\L
set CLASSPATH=%APP_HOME%\lib\f
set CLASSPATH=%APP_HOME%\lib\i
still i am getting the same problem.
i am working on Windows2000.
i think in windows the default classpath size is 2kb.
am i right?
how can i set my classpath size?
thanks
km
ASKER
Dear el_dios
i created the batch script as, but i am getting the same problem.....
@echo on
set APP_HOME=F:\Working\Source \EHR\devel opmentend\ EHR
set JAVA_HOME=C:\Program Files\Java\j2re1.4.2_10
set path=%APP_HOME%\bin;%JAVA_ HOME%\bin;
set MYAPPPATH=
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \itrust.ja r;%APP_HOM E%\lib\set tings.jar; %APP_HOME% \lib\ReadM eProps.jar ;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \resources .jar;%APP_ HOME%\lib\ sgml.jar;% APP_HOME%\ lib\Commun icationCla sses.jar;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \images.ja r;%APP_HOM E%\lib\Com monClasses .jar;%APP_ HOME%\lib\ cryptix.ja r;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \common_ut il.jar;%AP P_HOME%\li b\middlewa re_fdb.jar ;%APP_HOME %\lib\comp onents_iui _label.jar ;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \xml4j.jar ;%APP_HOME %\lib\jai_ codec.jar; %APP_HOME% \lib\jai_c ore.jar;%A PP_HOME%\l ib\xalan.j ar;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \xercesImp l.jar;%APP _HOME%\lib \xmlParser APIs.jar;% APP_HOME%\ lib\batik- awt-util.j ar;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \batik-uti l.jar;%APP _HOME%\lib \batik.jar ;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \avalon-fr amework-cv s-20020806 .jar;%APP_ HOME%\bin;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \control.j ar;%APP_HO ME%\lib\hi _att.jar;% APP_HOME%\ lib\insu.j ar;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \lab_res.j ar;%APP_HO ME%\lib\le vel_servic e.jar;%APP _HOME%\lib \maps.jar;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \physical. jar;%APP_H OME%\lib\p roc_diag_c odes.jar;% APP_HOME%\ lib\vitals igns.jar;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \LabTests. jar;%APP_H OME%\lib\j RegistryKe y.jar;%APP _HOME%\lib \CAG_lib.j ar;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \fop.jar;% APP_HOME%\ lib\itrust pdf.jar;%A PP_HOME%\l ib\PDF_Cla sses.jar;
set MYAPPPATH=%MYAPPPATH%;%APP _HOME%\lib \itext-1.2 .jar;%APP_ HOME%\lib\ jRegistryK ey.jar;
java -mx200m -cp "%MYAPPPATH%" -Djava.library.path=%APP_H OME%\bin -Dcom.itrust.ariel.dataman ager.file= "file:///c :/Medplexu s/EHR/lib/ ariel.prop erties" -Dcom.itrust.ariel.client. home=C:/Me dplexus/EH R -Dmedplexus.system.copy.ho me=C:/MedP lexus -Dcom.itrust.ariel.sgml.co ntrolfile= "file:///C :/Medplexu s/EHR/lib/ sgml_role. properties " -Dcom.itrust.ariel.sgml.ad min.contro lfile="fil e:///C:/Me dplexus/EH R/lib/sgml _admin.pro perties" com.itrust.ariel.client.Lo gon
thanks
km
i created the batch script as, but i am getting the same problem.....
@echo on
set APP_HOME=F:\Working\Source
set JAVA_HOME=C:\Program Files\Java\j2re1.4.2_10
set path=%APP_HOME%\bin;%JAVA_
set MYAPPPATH=
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
set MYAPPPATH=%MYAPPPATH%;%APP
java -mx200m -cp "%MYAPPPATH%" -Djava.library.path=%APP_H
thanks
km
create a jar file including all the jar files, except the one with main method (which contains the class com.itrust.ariel.client.Lo gon).
now specify the path of two jar files in you class path.
now specify the path of two jar files in you class path.
ASKER
still i am getting the classpath not found error.
why it is,
in all our code i am importing other classes which are in some other package.
import com.test.pack1;
so, the jar must include the package structure (com.test.pack1)
trhanks
km
why it is,
in all our code i am importing other classes which are in some other package.
import com.test.pack1;
so, the jar must include the package structure (com.test.pack1)
trhanks
km
the problem might be.....jvm might search for classes in all the jar files that are in the class path.
but i m not sure whether the jar files within the jar file are searched for required classes.
one think u can do is - extract all the jar files and then create a jar file.
So now, the new jar file will contain classes directly inside of being in another jar.
you can achive this by writing a simple ant script.
here is the documentation on how to use ant
http://ant.apache.org/manual/index.html
but i m not sure whether the jar files within the jar file are searched for required classes.
one think u can do is - extract all the jar files and then create a jar file.
So now, the new jar file will contain classes directly inside of being in another jar.
you can achive this by writing a simple ant script.
here is the documentation on how to use ant
http://ant.apache.org/manual/index.html
> extract all the jar files and then create a jar file.
i will make this sentence more clear.
extract all the classes within all the jar files in a temp folder.
then create a jar file of all these classes
i will make this sentence more clear.
extract all the classes within all the jar files in a temp folder.
then create a jar file of all these classes
1) When you were asked to create a single jar with all class files you must actually maintain the same directory structure. Not sure if you actually unjarred all files to a folder and then jarred it back again?
2) Also when you get such a big error, saying application doesnt start up, can you print exact output of the command line. I once had a classpath which was like 2 pages long in Windows and it still used to work.
2) Also when you get such a big error, saying application doesnt start up, can you print exact output of the command line. I once had a classpath which was like 2 pages long in Windows and it still used to work.
ASKER
dear avintham,
i should maintain 100 jars separately.
is there any way to set the classpath size?
thanks
km.
i should maintain 100 jars separately.
is there any way to set the classpath size?
thanks
km.
put the jars in the jre's ext directory
then u won't need to include them in the classpath, they'll get found automatically
then u won't need to include them in the classpath, they'll get found automatically
> is there any way to set the classpath size?
i guess NO
i guess NO
ASKER
yes objects,
i know about that.
is there any way in windows to set the classpath size?
thanks
km
i know about that.
is there any way in windows to set the classpath size?
thanks
km
>> set CLASSPATH=%APP_HOME%\lib\i trust.jar; %APP_HOME% \lib\setti ngs.jar;%A PP_HOME%\l ib\ReadMeP rops.jar;
Did you put all of them in a batch-file and tried to run them? Try to run those commands one by one on the command-prompt.
Did you put all of them in a batch-file and tried to run them? Try to run those commands one by one on the command-prompt.
yes you need to increase the environemt space
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thats the same as using the ext directory. Questions about setting the classpath.
>>Thats the same as using the ext directory.
No it isn't ;-)
No it isn't ;-)
in fact all it does it just define another ext directory.
Precisely. That's why it's not the same
ROTFL, whatever u say :-D
krishnasaikarthik, if you need more info about the differences under 'discussion', let me know
:-)
I stated above u could put them in an ext directory and they'd get picked up automatically.
And u said you knew about that??
And u said you knew about that??
ASKER
dear objects,
yes,
but i am not interested to place all the jar files in the JRE's ext directory.
i am interested to place them in our own directory & setting that directory as an ext directory.
thanks
km
yes,
but i am not interested to place all the jar files in the JRE's ext directory.
i am interested to place them in our own directory & setting that directory as an ext directory.
thanks
km
you can have an ext directory wherever you want :)
include that in your path.
cheers