user3456349
user3456349

Reputation: 95

Running a Java programme on Debian

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

Upvotes: 1

Views: 2137

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1074038

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)... :-)

Upvotes: 5

Related Questions