I have written a code (Java using eclipse Juno) which uses plink (C: installation) to connect to a remote server.
String command = "C:\\Program Files\\PuTTY\\plink -load session-name -l login -pw password";
Process p = runtime.exec (command);
Is there anyway I can safely export it (putty/plink) along with the jar file. This is so as there would not be any need of separate installation. I would also have to alter the code to call plink locally.
Thanks.
Use jar utility that comes with Java SDK to package putty executables to your application jar file.
Upon installation you can extract your exe file to a folder. And later call it from your code.
I am using the below code in plink.
"C:\Users\YXS8699\Desktop\Desktop\ansi165\x86\ansicon.exe \"C:\Progra~1\PuTTY\plink.exe\" ";
It was working fine.
Now when we run the plink command to connect WYSE50 terminal. I am facing the below issue
Command Prompt:
"C:\Program Files\PuTTY\plink.exe" CPHPQPU1.homedepot.com -l dbxd -pw 123summer -t WYSE50
Using keyboard-interactive authentication.
Password:
Now it is not working fine. Please give me some inputs.
Regards,
Yellappa
Related
I have built an executable jar file which is also a standalone SpringBoot Application. The requirement is that I have to run this jar file from command line which also provides command line arguments which are meant to override application.properties properties and will be used further.
I have tried and this works perfectly when ran from Windows Command Prompt.
Now I further want to deploy this on jenkins and run the same jar file usign jenkins using the command:Note that the command is important since it overrides application.properties.
Will it work in jenkins? Should i go with "Execute Shell" or "Execute Windows batch command" for it in jenkins? I would be trying it but need o know .
Command: java -jar myJArName.jar --server.port=10 --another.argument=1 --another.argument=2
Yes, you can use execute shell as you mentioned above if:
Java is installed on the host that Jenkins runs on
java is part of $PATH (you can check this by running which java on your jenkins host)
myJarName.jar is actually on the host jenkins runs on
Btw. I assume Jenkins runs on a Linux host. Otherwise you might have to use Execute Windows batch command which will work in a similar way to execute shell, but I never used it.
How to deploy the jar/war file in unix box and it should not stop after closing putty.
Steps tried:
Created jar/war file from Springboot project
Login to Unix box with root user
Created a Project folder in /opt path
Copied the jar/war file in Project folder
Executed below command to run the application in putty:
Command: java -jar myapplication.jar
Application is running fine but issue comes when i close my putty. Application shutdowns.
Any suggestions...
you need to create your custom service in your machine
EX: In Linux we use sudo systemctl start MySQL like that you have to create,
Please refer to this documentation which will help you to create your own.
EX: sudo systemctl start my_java_spring_service
I hope it helps!
I wrote a little java program and now I want to execute this .jar file from a .sh script.
my script:
#! /bin/bash
java -jar /var/spool/sms/sentSMS.jar
then i run the command: sudo bash sentSMS.sh
an get following error:
ERROR: Unable to access jarfile /var/spool/sms/sentSMS.jar
I am using a Raspberry with raspian-jessie, if this important to solve it.
Sorry, but I'm new in scripting with linux.
Take into account that the user must have at least READ permissions on that file.
Also, as you say you are new in linux, make sure the name is correct. sentSMS.jar is different from sentsms.jar
I'm using Java EE with Glassfish.
I can't run asadmin command as well. I did the following, but output from terminal is:
No command 'asadmin' found, did you mean: Command 'amadmin' from package 'amanda-server' (universe) Command 'acsadmin' from package'ion' (universe) asadmin: command not found
I have Ubuntu 14.04 Trusty Tahr. I should be in bin directory of glassfish, so I'm in /opt/glassfish4/bin.
But always nothing happend, just error message above.
In Ubuntu and Linux in generál, you run commands from current directory like this: ./asadmin, ie. you must prepend ./ to make it explicit that you run a command I current directory. This is traditionally for some security reasons.
Try following command export PATH=/installationDirectory/glassfishName/bin:$PATH
In my case it was export PATH=/opt/glassfish4/bin:$PATH
The asadmin command needs to be read from glassfish bin directory when executing commands, hence you need to export the following in your environment variables.
On mac,
export PATH=/Users/macpro15/Downloads/glassfish5/bin:$PATH
I think you are creating the domain inside the default domain. You should make your own domain in the domains folder, and the run the following command in your terminal:
sh asadmin start-domain DOMAIN_NAME
Per the installation directions I run:
./bin/sqoop.sh client
and it returns error:
could not find or load main class org.apache.sqoop.shell.SqoopShell
I'm setting up Sqoop for the first time. I have the server up and running on Redhat Linux. Now I am stuck running the client on Windows Server 2012. I am running hadoop v2 and sqoop-1.99.3-bin-hadoop200. At the command line I verified java is installed by running "java -version" at the command line and seeing "1.8.0". Scoop is written in Java 1.6. Does that matter? I'm having difficulty locating an active download link to 1.6 for windows for troubleshooting.
I tried installing Cygwin and running the command. Same error.
Locate the directory traversal for the case of client in sqoop.sh
# Build class path with full path to each library
for f in $SQOOP_CLIENT_LIB/*.jar; do
CLASSPATH="${CLASSPATH}:$f"
done
Just add the following search and replace params (note changes of colon to semicolon in classpath)
# Build class path with full path to each library
PARAMSEARCH="/c/"
PARAMREPLACE="C:\\"
for f in $SQOOP_CLIENT_LIB/*.jar; do
f=${f/$PARAMSEARCH/$PARAMREPLACE}
CLASSPATH="${CLASSPATH};$f"
done
I had the same issue running on Windows 8.1. Turns out it's caused because sqoop.sh uses POSIX style directory paths. So / instead of . This results in the script being unable to set the correct CLASSPATH. This could have been remedied by using a cmd file for Windows. I don't know why they didn't do it. There are cmd files for catalina and such but not for launching sqoop!
Anyway I got around this issue by adding all the jar files in the shell\lib folder to CLASSPATH. You do have to add each & every jar file there and not just the folder path. A restart was required after this which was annoying. However the shell script will still not launch the client even after this change. The little trick I used is to just launch the client at the command prompt from the shell\lib folder with the following command
***java org.apache.sqoop.shell.SqoopShell***
Now I get the groovy prompt from where I can run all the commands provided here
I used the following steps to configure sqoop in a windows machine and now able to work with sqoop 1.99.3 successfully.
*Cygwin must be installed before continuing further steps. Also its just for using the native libraries, we can interact with sqoop directly from windows command prompt.
Save the sqoop package folder in “C:” drive name as sqoop
Copy the hadoop lib folder “hadoop” from C:\hadoop\share into C:\usr\lib\hadoop [If this directory doesn't exists, then create one]
Change the hadoop configuration properties in the file “sqoop.properties” from the location “C:\sqoop\server\conf” as below
at line:132
org.apache.sqoop.submission.engine.mapreduce.configuration.directory=C:\hadoop\etc\hadoop
Copy the sqoop.properties and sqoop_bootstrap.properties from “C:\sqoop\server\conf” into “C:\sqoop\server\bin”.
Set the environment variables for sqoop home as well as path:
SQOOP_HOME = C:\sqoop
Starting the server:
Open Command prompt (run as Administrator) and enter into the $SQOOP_HOME location and type command as follows
C:\sqoop> cd server\bin
C:\sqoop\server\bin> catalina start
The catalina server will be start and check it in the below location
http://localhost:12000/sqoop
Client Shell Command
Open the command prompt and enter the following command
java -classpath C:\sqoop\shell\lib\sqoop-shell-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\sqoop-common-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\sqoop-client-2.0.0-SNAPSHOT.jar;C:\sqoop\shell\lib\log4j-1.2.16.jar;C:\sqoop\shell\lib\json-simple-1.1.jar;C:\sqoop\shell\lib\jline-0.9.94.jar;C:\sqoop\shell\lib\jersey-core-1.11.jar;C:\sqoop\shell\lib\jersey-client-1.11.jar;C:\sqoop\shell\lib\jansi-1.7.jar;C:\sqoop\shell\lib\hamcrest-core-1.3.jar;C:\sqoop\shell\lib\groovy-all-1.8.5.jar;C:\sqoop\shell\lib\commons-lang-2.6.jar;C:\sqoop\shell\lib\commons-cli-1.2.jar org.apache.sqoop.shell.SqoopShell
The client shell command will be displayed as :
Sqoop Shell: Type 'help' or '\h' for help.
sqoop:000>
Hope this helps
Thanks