Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 16, 2011, 04:04 AM   #1
China Diapers
macrumors newbie
 
Join Date: Feb 2011
Hi,

I am trying to run a java solution remotely on a server, I am using the below command in the terminal:

Quote:
java RemoteShellClient 87.120.209.147 50001 "cmd" "java -jar -Dusername=xxx -Dpassword=xxx -DcCodes=all C:\BetInTime.jar ServiceSF"
Confidential info hidden with x's.

But am getting the below error:

Quote:
Invalid input data
Could this be a syntax error?

Thanks

OK, on further inspection, the shellscript seems to rely on some batch files:

Quote:
CommandRunner.class
RemoteShell.jar
SockData.class
CommandRunner.java
RemoteShellClient.class
SockData.java
JavaBuild.bat
RemoteShellClient.java
java
JavaClient.bat
RemoteShellServer.class
JavaServer.bat
RemoteShellServer.java
Contents of which are:

Quote:
set ClassPath=RemoteShell.jar
java RemoteShellServer %1 %2
Quote:
set ClassPath=RemoteShell.jar
java RemoteShellClient %1 %2 %3 %4
Quote:
javac -g:none *.java
jar cvf RemoteShell.jar *.class
Do you think it would help to rewrite these as bash files?

Last edited by r.j.s; Apr 16, 2011 at 05:01 PM. Reason: Post Merge - Please use edit
China Diapers is offline   0 Reply With Quote
Old Apr 16, 2011, 06:21 AM   #2
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
The direct port of these batch files to bash scripts would be, respectively:

Code:
export CLASSPATH=RemoteShell.jar
java RemoteShellServer $1 $2
Code:
export CLASSPATH=RemoteShell.jar
java RemoteShellClient $1 $2 $3 $4
Code:
javac -g:none *.java
jar cvf RemoteShell.jar *.class
But you seem to be by-passing them by using java RemoteShellClient directly from the command line. So I don't think they're the cause of your error.

According to JavaClient.bat (now the JavaClient bash script), RemoteShellClient expects 4 arguments. From the look of the command your trying to use, these arguments are: 1) the IP address of the remote computer, 2) the port of the remote computer, 3) the command to run on the remote computer, 4) the arguments to be passed to the remote command. The remote command and argument suggests that the remote computer is running Windows. Is that the case?

Do you know where the error is coming from? I've not seen bash output this error, so I doubt it's coming from there. Is there other output to suggest it's coming from RemoteShellClient, or from the remote computer?

Last edited by jiminaus; Apr 16, 2011 at 07:28 AM.
jiminaus is offline   0 Reply With Quote
Old Apr 16, 2011, 11:56 AM   #3
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by China Diapers View Post
Code:
java RemoteShellClient 87.120.209.147 50001 "cmd" "java -jar -Dusername=xxx -Dpassword=xxx -DcCodes=all C:\BetInTime.jar ServiceSF"
This command won't work.

The pathname to the jar file must immediately follow the -jar option, like this:
Code:
java -jar C:\BetInTime.jar  -Dusername=xxx -Dpassword=xxx -DcCodes=all ServiceSF"
or this:
Code:
java -Dusername=xxx -Dpassword=xxx -DcCodes=all -jar C:\BetInTime.jar ServiceSF"

Based on the batch files, I'm not convinced that -jar is the option to use. -cp may be better suited, if you're expecting to run the ServiceSF class. Example:
Code:
java -cp C:\BetInTime.jar  -Dusername=xxx -Dpassword=xxx -DcCodes=all ServiceSF"

Last edited by chown33; Apr 16, 2011 at 12:10 PM.
chown33 is offline   0 Reply With Quote
Old Apr 17, 2011, 07:30 AM   #4
pilotError
macrumors 68020
 
pilotError's Avatar
 
Join Date: Apr 2006
Location: Long Island
Wouldn't it be easier to wrap the command in a bash script and do an rexec to execute it remotely?
pilotError is offline   0 Reply With Quote
Old Apr 17, 2011, 11:46 AM   #5
wlh99
macrumors 6502
 
Join Date: Feb 2008
Code:
java RemoteShellClient 87.120.209.147 50001 "cmd" "java -jar -Dusername=xxx -Dpassword=xxx -DcCodes=all C:\BetInTime.jar ServiceSF"
I would break troubleshooting this into two parts:

1. Test that you can remotely execute a command by doing something trivial. Perhaps like this:

Code:
java RemoteShellClient 87.120.209.147 50001 "cmd" "echo testfile > testfile.txt"
Assuming that the RemoteShell server is running, has correct permissions to write somewhere, and you know where that somewhere is you should see a testfile.txt created there. If this doesn't work, then you need to check the server config.

2. Locally run the BetInTime.jar file on the server to verifiy it works properly and that the command arguments are correct. From the C:\ prompt on the server:
Code:
 java -jar -Dusername=xxx -Dpassword=xxx -DcCodes=all C:\BetInTime.jar ServiceSF
If that doesn't work, you need to figure out why, and adjust the command so it does.
__________________
Warren Holybee
wlh99 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Dictonary from command line Crusader007 OS X 1 Feb 25, 2014 07:21 PM
General: iOS7 command line... Equivalent of "say" command? RobertoG Jailbreaks and iOS Hacks 0 Jan 19, 2014 05:05 PM
Command Line newb jeanniebeannie Mac Basics and Help 8 Oct 9, 2013 11:25 AM
Get Full Model Name from the Command Line cranfordio OS X 3 Mar 21, 2013 01:07 PM
Need Command-line help EricBrian Community Discussion 1 Feb 20, 2013 08:40 PM

Forum Jump

All times are GMT -5. The time now is 02:59 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC