Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Note that I already have a CLASSPATH env var that points to the location of all of the .jar files, so perhaps it's as easy as a simple M$-style modification to the last line?
classpath="$scriptdir/lib/antlr-2.7.7.jar:$scriptdir/lib/mysql-connector-java-5.1.20-bin.jar:$scriptdir/lib/hibernate-commons-annotations-4.0.1.Final.jar:<a whole bunch of other jar files>:$scriptdir/lib/org.hibernate.common.hibernate-commons-annotations-4.0.1.Final.jar:$scriptdir/lib/gluetop_2.10-0.1.4.jar"
exec java -Dhttp.port=9999 $* -cp "$classpath" play.core.server.NettyServer `dirname $0`
@FireRat, there is nothing at the company's website to link to; that isn't an option.
:: put this in a file called start.bat
set scriptdir=%~dp0set classpath=%scriptdir%lib/antlr-2.7.7.jar;<etc...>%scriptdir%lib/gluetop_2.10-0.1.4.jar
java -Dhttp.port=9999 %* -cp %classpath% play.core.server.NettyServer %~dp0
You might need to put quotes around %scriptdir% in the last line, but if all your paths are without whitespace maybe not. The rules for quoting in batch files are somewhat crazy, you can't just always quote for safety like in unix.
It's also possible it would work from cygwin if you just change the ":" to ";" in the classpath.
Last edited by ntubski; 09-13-2013 at 05:47 PM.
Reason: remove stray quote; had %scriptdir% where %classpath% was wanted
Hmm, if all the jars are in the same dir maybe using wildcard in the classpath as mentioned in that link from YankeePride13 would help:
Class path wildcards allow you to include an entire directory of .jar files in the class path without explicitly naming them individually. For more information, including an explanation of class path wildcards, and a detailed description on how to clean up the CLASSPATH environment variable, see the Setting the Class Path technical note.
Oh, also I left a stray quote on that line, not sure if that's relevant.
1) The path for all of the .jars is so long that Windows can't handle it.
The 2 possible solutions 1 possible solution would be:
Specifying the .jars with a wildcard, thereby avoiding passing every single one via command line (this assumes most are in the same directory, not necessarily all but enough to make the list fit under the limit).
java -Dhttp.port=9999 -cp %scriptdir%lib/* %* play.core.server.NettyServer %~dp0
Specifying the .jars by setting the classpath variable instead the -cp option, this avoids the command line limit (assumes you don't hit the environment variable length limit, is there one?).
java -Dhttp.port=9999 %* play.core.server.NettyServer %~dp0
2) Should it really be %scriptdir%lib...etc. Isn't a slash missing, e.g., %scriptdir%/lib...?
%~dp0 includes a trailing slash (a backslash, in fact).
Last edited by ntubski; 09-14-2013 at 11:14 AM.
Reason: command line limit applies to set commands
The maximum size of a user-defined environment variable is 32,767 characters. There is no technical limitation on the size of the environment block. However, there are practical limits depending on the mechanism used to access the block. For example, a batch file cannot set a variable that is longer than the maximum command line length.