connect to unix server through java
843790Mar 23 2007 — edited Jun 14 2007Hi All,
I've seen this topic being discussed here, but I want to clarify my situation.
I'm a college student, so our school provides us accounts to a unix server.
I am writing a java program that needs to connect to this unix server owned by the school, and run some commands and obtain the results and display them in the same java program.
for example after the connection, I use the java Runtime() method to pass the "pwd" command from my program, and my java program should receive the result something like "/university/student/program" from the server, and I should be able to display in the java program.
I feel like since the unix from school is already acting as a "server," I don't need to write the server side code, it should be handled by the unix system, right?
Can someone give me a sample code on how to establish such connection?
BTW, I usually use ssh to access the unix server.
Much appreciated, and it's kinda urgent.
Thank You.