Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APP_CLASSPATH line growths too long in windows startup batch script #1071

Closed
torao opened this issue Nov 29, 2017 · 2 comments
Closed

APP_CLASSPATH line growths too long in windows startup batch script #1071

torao opened this issue Nov 29, 2017 · 2 comments

Comments

@torao
Copy link

torao commented Nov 29, 2017

Expected behaviour

Batch script that made by universal:packageBin for Windows 10 starts my application.

Actual behaviour

"Input line is too long” error is shown.

Information

The problem is that the line set APP_CLASSPATH=... in batch file exceeds the Windows limit of 8,191 chars when dependency libraries in project increases.

It's able to avoid this limitation to divide into multiple lines instead of setting classpath on one line.

set "APP_CLASSPATH=%APP_LIB_DIR%\library1.jar"
set "APP_CLASSPATH=%APP_CLASSPATH%;%APP_LIB_DIR%\library2.jar"
set "APP_CLASSPATH=%APP_CLASSPATH%;%APP_LIB_DIR%\library3.jar"
...

I think it seems to be enough to fix

"set \"APP_CLASSPATH=" + (cp map { path =>
  if (isAbsolute(path)) path else makeRelativePath(path)
} mkString ";") + "\""

in file BatStartScriptPlugin.scala to like follows

val files = cp map { path => if (isAbsolute(path)) path else makeRelativePath(path) }
"set \"APP_CLASSPATH=" + files.head + "\"" + System.lineSeparator() + (files.drop(1) map { path =>
  "set \"APP_CLASSPATH=%APP_CLASSPATH%" + File.pathSeparator + path + "\""
} mkString System.lineSeparator())

.

  • Terminal on IntelliJ IDEA 2017.2.6
  • sbt 1.0.4
  • sbt-native-packager 1.3.1 and 1.1.4
  • Java 1.8.0_141
  • Scala 2.12.4
  • build and target system is Windows 10

2017-11-29 16 35 30

@dwickern
Copy link
Collaborator

This is a common problem on Windows. Splitting up the set APP_CLASSPATH=... onto multiple lines won't help: running the concatenated command string will fail due to the same 8192 character limit.

I'd recommend generating a classpath jar. Have a look at Dealing with long classpaths

@torao
Copy link
Author

torao commented Nov 29, 2017

argh. that's right. Thank you for your information, I solved my problem to use classpath jar. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants