0

I need to compile my .jar file many times in a day, so I got a idea I could make a BAT file to compiler faster here it is:

call "jar cmf 'META-INF/MANIFEST.MF' 'Bounce Tales.jar' a a.class aa.png ab.png ac.png ad.png ae.png af.png ag.png ah.png ai.png aj.png ak.png al.png am.png an.png ao.png ap.png aq.png ar.png as.png at.png au.png av.png aw.mid ax.mid ay.mid az.mid b b.class ba.mid bb.mid bc.mid bd.mid be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv c.class c.png d.class d.png e.class e.png f.class f.png g.class g.png h.class h.png i.class i.png icon.png j.class j.png k.class k.png l.class l.png lang.bs-BA lang.cs-CZ lang.de lang.hr-HR lang.hu-HU lang.mk-MK lang.sk-SK lang.sl-SI lang.sq lang.sr-YU lang.xx m.class m.png n.class n.png o.class o.png p.class p.png q.class q.png r.class r.png RMIDlet.class s.png t.png u.png v.png w.png x.png y.png z.png"

This resulted a error:

The input line is too long.

I don't have any idea how to make it shorter, and when I copypaste the command to the console, it compiles just fine...

Kjuly
  • 34,476
  • 22
  • 104
  • 118
gskartwii
  • 389
  • 2
  • 7
  • 18
  • possible duplicate of [how to increase the input line length(max) in windows?](http://stackoverflow.com/questions/3930579/how-to-increase-the-input-line-lengthmax-in-windows) – PA. Oct 05 '12 at 18:53
  • why do you put the command after call in quotes? normally you just `call somebatfile` or `call somecommand parameters` – phuclv Apr 22 '17 at 11:25

3 Answers3

1

You can break your line up into several variables, and use them to call your process. That's the way we used to get the path longer than the number of characters MSDOS limited a command-line to.

set a=a a.class aa.png ab.png ac.png ad.png ae.png af.png ag.png ah.png ai.png aj.png ak.png al.png am.png an.png ao.png ap.png aq.png ar.png as.png at.png au.png av.png aw.mid ax.mid ay.mid az.mid 

set b=b b.class ba.mid bb.mid bc.mid bd.mid be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv c.class c.png d.class d.png e.class e.png f.class f.png g.class g.png h.class h.png i.class i.png icon.png j.class j.png

set c=k.class k.png l.class l.png lang.bs-BA lang.cs-CZ lang.de lang.hr-HR lang.hu-HU lang.mk-MK lang.sk-SK lang.sl-SI lang.sq lang.sr-YU lang.xx m.class m.png n.class n.png o.class o.png p.class p.png q.class q.png

set d= r.class r.png RMIDlet.class s.png t.png u.png v.png w.png x.png y.png z.png

call "jar cmf 'META-INF/MANIFEST.MF' 'Bounce Tales.jar' %a% %b% %c% %d%"
James K
  • 4,005
  • 4
  • 20
  • 28
  • But this will not work, as the counting begins after the expansion, this way the limit of 8191 characters is still unchanged – jeb Oct 07 '12 at 09:45
0

This question is a copy of: how to increase the input line length(max) in windows?

To run a batch file with a long input string, you have to delimit it with the ^ character.

call "jar cmf 'META-INF/MANIFEST.MF' 'Bounce Tales.jar' a a.class aa.png ab.png ac.pngad.png ae.png af.png ag.png ^
ah.png ai.png aj.png ak.png al.png am.png an.png ao.png ap.png aq.png ar.png as.png at.png au.png av.png aw.mid ax.mid ^
ay.mid az.mid b b.class ba.mid bb.mid bc.mid bd.mid be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv c.class ^
c.png d.class d.png e.class e.png f.class f.png g.class g.png h.class h.png i.class i.png icon.png j.class j.png ^
k.class k.png l.class l.png lang.bs-BA lang.cs-CZ lang.de lang.hr-HR lang.hu-HU lang.mk-MK lang.sk-SK lang.sl-SI ^
lang.sq lang.sr-YU lang.xx m.class m.png n.class n.png o.class o.png p.class p.png q.class q.png r.class r.png ^
RMIDlet.class s.png t.png u.png v.png w.png x.png y.png z.png"
Community
  • 1
  • 1
Gregg
  • 121
  • 4
  • 3
    Two serious problems with this answer. 1) Line continuation does not extend the max length allowed, it just looks better in your text editor. 2) Your line continuation fails in this case because the `^` characters are quoted. – dbenham Oct 05 '12 at 19:09
0

Okay, I found it. I used this:

jar cmf "META-INF/MANIFEST.MF" "Bounce Tales.jar" a a.class aa.png ab.png ac.png ad.png ae.png af.png ag.png ah.png ai.png aj.png ak.png al.png am.png an.png ao.png ap.png aq.png ar.png as.png at.png au.png av.png aw.mid ax.mid ay.mid az.mid b b.class ba.mid bb.mid bc.mid bd.mid be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv c.class c.png d.class d.png e.class e.png f.class f.png g.class g.png h.class h.png i.class i.png icon.png j.class j.png k.class k.png l.class l.png lang.bs-BA lang.cs-CZ lang.de lang.hr-HR lang.hu-HU lang.mk-MK lang.sk-SK lang.sl-SI lang.sq lang.sr-YU lang.xx m.class m.png n.class n.png o.class o.png p.class p.png q.class q.png r.class r.png RMIDlet.class s.png t.png u.png v.png w.png x.png y.png z.png

I put that in the BAT file.

gskartwii
  • 389
  • 2
  • 7
  • 18