Automatically set ClassPath method

zhaozj2021-02-16  51

The most headache when using Java is to set a lot of ClassPath, I have written several scripts to automatically add the .jar files in a directory to the classpath variable.

Batch 1: add2cp.bat (add the first parameter to the variable CP)

@set CP =% CP%;% 1

Batch 2: addjars2cp.bat (added to the JAR file in the directory specified by the first parameter to the CP variable)

@for %% I in (% 1 / *. jar) do @call add2cp.bat %% ~ FI

Test program: TestAddjars2cp (Test the function of addjars2cp.bat)

@set cp =. @call addjars2cp.bat d: /j2sdk1.4.0/lib @echo% CP%

Using this method in J2EE 1.3.1, WebLogic, Tomcat's script is used without manually adding the value of ClassPath.

转载请注明原文地址:https://www.9cbs.com/read-25595.html

New Post(0)