1

I am trying to move a programme I have from hosting it from a Windows machine to a debian one. I have installed JRE and JDK on the machine.

The .bat file I usually use is -

@echo off
"C:\Program Files (x86)\Java\jdk1.7.0_51\bin\java.exe" -Xms512m -Xmx1024m -cp bin;lib/*     org.zarketh.Server false
pause

This is the command I try to use on terminal -

java -cp bin;lib/* org.zarketh.Server false 43594

I get the following error

lib/gson-2.2.2.jar: line 1: $'PK\003\004': command not found
lib/gson-2.2.2.jar: line 2: $'\227\220\342@': command not found
lib/gson-2.2.2.jar: line 3: syntax error near unexpected token `$'\332\001\001X5
0

1 Answer 1

5

The separator for classpath on *nix is :, not ;, so:

java -cp bin:lib/* org.zarketh.Server false 43594

It's worth noting that this is also true of the PATH environment variable, which uses : on *nix and ; on Windows.


The reason you're seeing the error you're seeing is that ; in most (all?) shells (*nix command lines) is an end of command separator. So it was treating what you typed as two separate commands:

java -cp bin
lib/* org.zarketh.Server false 43594

I guess the gson-2.2.2.jar file has the executable bit set, so the shell was trying to run it (directly, not with Java)... :-)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.