I'm trying to use Jmeter but am coming across an issue when I try and run it using the Jmeter.bat file.
It's spits out the following error:
'java -version 2>&1 | findstr /i "version"' is not recognized as an internal or external command, operable program or batch file.
Not able to find Java executable or version. Please check your Java installation.
errorlevel=2
Press any key to continue . . .
I've tried googling this and lots of posts mention that this error is usually down to the environment variables not being set correctly, but I'm fairly sure they are as if I type java or javac into the command prompt I get a response.
I've got them set as follows:
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_25
JDK_HOME : %JAVA_HOME%
JRE_HOME : %JAVA_HOME%\jre
CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
PATH : your-unique-entries;%JAVA_HOME%\bin
I tried taking the string it's complaining about and pasted that into the command prompt by itself and it ran fine:
C:\Windows\System32>java -version 2>&1 | findstr /i "version"
java version "1.8.0_25"
So why is it throwing the error when running the batch file but not if I paste it in manually? The batch file is located in a folder in my C drive and I'm running by right clicking and selecting 'Run as Administrator'. If I just double click the .bat file I get the error:
Windows cannot find 'C:\apache-jmeter-2.13_src\bin\jmeter.bat'. Make sure you typed the name correctly, and then try again
Is the above error related or is that a separate permissions issue?
Thanks for any help
From command Prompt go to bin folder of apache jmeter and type following command:
C:\apache-jmeter-3.0\bin> java -jar ApacheJmeter.jar
I also faced similar problem when I extracted the JMeter in C. In my case, i don't have admin rights. I assume it is related to some permission issue. So better copy to D: and then check.
Copy C:\apache-jmeter-2.13_src folder to other drive (D:) or download JMeter and extract in D drive and run the batch file.
Related
I am running for Java -version & javac -version in my cmd, but it isn't showing any output.
It just goes to the next line, and doesn't show anything.
Can anyone here can help me. Any solution ,guys?
I have also added an environment variable for it.
I have attached a screenshot of it.
I got an answer to this.
Here this came after running the command where java.exe,
here I see that I have two java.exe. On inside Common files and another inside Java. So , Because of this only I wasn't getting the answer.
PS C:\Users\absasahu> where.exe java.exe
C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
C:\Program Files (x86)\Java\jre1.8.0_333\bin\java.exe
After deleting the first java.exe file, I got my work done.
https://i.stack.imgur.com/KSKal.png
Hi download java this one:
https://download.oracle.com/java/19/latest/jdk-19_windows-x64_bin.exe ( sha256)
Then go Settings , environment variable , JAVA_HOME C:\Program Files\Java\jdk-19\NewJava . I created newJava as folder while installing Java . and also set path C:\Program Files\Java\jdk-19\NewJava\bin
Then type in command prompt java -version
So, I am trying to run a program from jar files. It uses javaswing and has a gui.
The program runs fine in netbeans and in eclipse.
When I try to run it from the exported jar file it says this:
Unable To Install Java
There are errors in the following switches:
"C:\Users\CNC Department\Desktop\ValveConversion.jar";.
Check that the commands are valid and try again.[java installation not complete
Now, I also tried doing it from the command prompt. Here is what came up:
[cmd prompt attempt][1] [1]: https://i.stack.imgur.com/7reZ3.png
So, I reinstalled the java JDK, java SDK, netbeans and eclipse. The issue is still occurring in both command prompt and from running the jar file directly.
What am I doing incorrectly here? What do you recommend that I do to get this to run from a .jar file?
You need to set the java path
Open a cmd with elevated privileges and run this command to set the JAVA_HOME environment variable using setx command:
setx JAVA_HOME -m "C:\Program Files\Java\jdk-11.0.2"
Then restart the cmd and run java -version to check if it's all ok.
For reference setx command documentation
Or simply use the following snippet if you prefer to use java without setting the PATH variable:
"C:\Program Files\Java\jdk-11.0.2\bin\java" -jar "C:\Users\CNC Department\Desktop\ValveConversion.jar"
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
I am unable to run a crontab job , under a different user.(For e.g sudo -u someuser crontab -e)
It runs absolutely fine under my user profile.
I know what is the issue, but cannot find the resolution for it.
The issue is , when i configure this crontab job for other user, crontab is not able to find java ,as a result even simple java -version is not working.
Below is my script.
#!/bin/bash
export JAVA_HOME=/usr/jdk/jdk1.6.0_31
export PATH=/usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin:/home/VishalS/bin
echo "JAVA_HOME is: " $JAVA_HOME >> log.out
echo "PATH is: " $PATH >> log.out
which java >> log.out
/usr/bin/java -version >> log.out
/usr/jdk/jdk1.6.0_31/bin/java -version >> log.out
output of above script :
JAVA_HOME is: /usr/jdk/jdk1.6.0_31
PATH is: /usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin:/home/VishalS/bin
/usr/bin/java
so obviously, the below lines did not work.
/usr/bin/java -version >> log.out
/usr/jdk/jdk1.6.0_31/bin/java -version >> log.out
Could somebody please help me here? I do not understand why even after setting jdk path crontab does not executes java -version ?
Try setting the paths in the other users crontab directly. See 'man 5 crontab'.
The only that comes to my mind is that, the java command might not have the Executable permission to the user you are trying to execute it from.
So use chmod to give necessary permissions to execute.
Crontab(5) runs without ENV, so you need to source an environment (you are building the JAVA_HOME and PATH, but crontab gives you (almost) nothing. notice that the output of "which java" did not appear in your log file.
build an environment script you can source for your crontab script(s), ". path/to/env.sh"
Put full paths on all programs executed in shell scripts etc. You cannot rely upon environment in cron
run "which which", did you get /usr/bin/which? then put that in your script.
we often omit paths from scripts for convenience, but give paths in scripts run from crontab
does the java run when logged in as the other user?
Thanks everyone for your helpful comments.
However the actual fix which worked in my-case , was mix of steps as mentioned below :-
1. Setup Sun JDK path under root's user profile.(earlier open jdk was setup)
2. Gave permission to logs folder where logs were being written.(earlier the permission were not correctly set)
3. Tweaked my cronjob(i think there was an extra space there)
Hi I am new to linux and I'm trying to run java file. I am following this site:
http://www.source-code.biz/snippets/java/7.htm
in "installation instruction" when I reach to,
javac JavaDaemonTest.java
I found error command not found then I go to the place where I install jdk 1.6
usr/java/jdk1.6/bin here I found javac command and then I try to run
javac JavaDaemonTest.java
still I am getting 'command not found error'
my environment variable in bash profile is set that is,
PATH=$PATH:$HOME/bin
export JAVA_HOME=/usr/java/jdk1.6.0_29/
export CLASSPATH=/usr/local/apache-tomcat-5.5.34-src/servletapi/jsr152/examples/WEB-INF/lib/jstl.jar:/usr/local/apache-tomcat-5.5.34-src/servletapi/jsr152/examples/WEB-INF/lib/jstl.jar
export PATH
unset USERNAME
how to get out of it
Thanks in advance.
its nothing about Java here, its just your shell doesn't know where to search for javac
Add to the $PATH env. variable your $JAVA_HOME/bin and try again. It should work now