Javac not recognised - batch-file

I tried typing the name of the bat file (makejar.bat) from the containing direcory from the command line. It gives several errors all containing "'javac' is not recognised as an internal or external command."

This sounds like a java class path problem.
You can find the instructions to set the java CLASSPATH on the following Oracle web page.

I suppose you are working on Windows, so make sure that your environment variables are properly set:
JAVA_HOME - points to a proper JDK installation
PATH - contains a references to JAVA_HOME, something like: **PATH;%JAVA_HOME%\bin**
This should do it! Make sure to restart the command line you are using after making changes to environment variables.
You can see how to set/add environment variables on windows here.

On CMD--> type--> PATH="c:\Program Files\Java\jdk1.8.0_144\bin";
and then check java path by type "java -version" on cmd
and also check on YouTube : -https://www.youtube.com/watch?v=mzAAmJj-W6w

Related

The term 'behave' is not recognized as the name of a cmdlet, function

I have Python 3.10.7 with the follwing packgaes installed using pip install in command line:
behave 1.2.6
selenium 4.4.3
These have also been added to the packagelist of the project using the project config in pycharm
Also behave is in the systme path as well along with python.
I am trying to use the behave command but I am getting the following error:
behave : The term 'behave' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ behave features\myfeaturefile.feature
Following is my project directory:
Following is my project in pycharm:
I need help in fixing this problem as I am new to this tool. Thanks
First check if you have behave and python in the path variables.
Check if you can execute the below command
C:\demo>behave -h
If this does not return a list of help commands associated with behave, this means that behave is not in the path variables
Alternatively, you can check it via cmd using the "PATH" command. This will show you all the entries in the system path
C:\demo>PATH
PATH=C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin...
If behave or python are not in the path variables, you can set them using
set PATH=%PATH%;c:\PATH_TO_BEHAVE
NOTE: Setting path using cmd is only valid till the time the cmd window is open. Once you close it, the path variable will be rest to original values.
Behave, along with a few other .exe files is sitting in the:
C:\Users\chauhany\AppData\Roaming\Python\Python310\Scripts
As per your instructions #Manish Agarwal, I added the C:\Users\chauhany\AppData\Roaming\Python to the PATH from the command line and re-started the machine. But it didn't help. I then moved the behave.exe from the above location to my python 3.10 directory which is sitting in C:\Program Files\Python310 and python is in the system path, and restarted my machine again.
I then deleted and recreated my project with the new feature file (same directory structure).
If I now run the same command, that is, features\myfeaturefile.feature from
C:\Users\chauhany\PycharmProjects\martechBehaveProject>
I get a FileNotFound error
So I went to the folder where the file is actually sitting that is:
C:\Users\chauhany\PycharmProjects\martechBehaveProject\features\steps> and then re-ran the command and it worked.
I was under the impression that if you have just one feature file you don't have to specify the actual feature file and it can be run from anywhere in your project i.e., from any location which certainly is not correct.

I've installed Hbase but when I type a commmand in cmd "hbase shell" the it shows the following error

Here is the error when I type "hbase shell"
*:\hbase-2.5.0\hbase-config.cmd"' is not recognized as an internal or external command, operable program or batch file. \Java\jdk1.8.0_261\lib\tools.jar was unexpected at this time.
and here comes another error when I type "start-hbase.sh"
The file does not have an app associated with it for performing this action. please install and app or if already installed, create an association in the Default Apps setting page
Seems like you are on windows (correct me if I'm wrong).
Your first command seems to come from an installation issue. The shell can't seem to find hbase-config.cmd. Make sure you followed the installation instructions properly and everything is where it's supposed to be.
As for the second error, you can't run bourne shell files (.sh extension) on windows.
It would be best you link the tutorial/documentation you followed in your original question, and add more information about your directory structure.

Having trouble setting up chocolateyinstall.ps1 to link path enviorment variable with program file

Having trouble setting automatically set PATH to programFiles\veyon after installation. I would like to use the veyon-ctl command line with out having to manually link it.
The code that you have highlighted seems to be working exactly as expected. I have just taken that code, and added it to a package and installed it. The result was the following...
As you will see mentioned in the output, this environment variable will not be available in the current shell until you open/close the shell. I suspect that this is the problem that you are running into.
Chocolatey does provide a helper function called refreshenv which would allow you to force the reloading of the environment variables into the current shell, however, this isn't enabled by default. You can find out how to do this by reading the article here:
https://chocolatey.org/docs/troubleshooting#i-cant-get-the-powershell-tab-completion-working
But what it comes down to is that you need to load the following into your PowerShell Profile:
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
Once this is loaded, after seeing output similar to the following when installing a Chocolatey package, you can execute the command refreshenv and the new environment variables will be available in the current shell.

Gatling Error: There is no simulation script. Please check that your scripts are in user-files/simulations

I'm new to Gatling and I'm trying to use ./gatling.sh to open a simulation script but I'm getting the following error:
There is no simulation script. Please check that your scripts are in
user-files/simulations
I can view multiple scripts within the user-files/simulations directory but still get the error.
Does anyone have any ideas why Gatling is not finding the simulation script?
TLDR
The error doesn't necessarily mean that there are no scripts, but that the gatling was not able to find compiled script.
In details
I was facing a similar error, but it was something like this:
Could not reserve enough space for 1048576KB object heap
There is no simulation script. Please check that your scripts are in user-files/simulations
So I opened the gatling.bat file and changed the parameter of set JAVA_OPTS from -Xmx1G to be -Xmx512M:
set JAVA_OPTS=-server -Xmx512M...
After I did that, the gatling was able to really start running, compiling the files and display:
Choose a simulation number:
[0] computerdatabase.BasicSimulation
[1] computerdatabase.advanced.AdvancedSimulationStep01
[2] computerdatabase.advanced.AdvancedSimulationStep02
[3] computerdatabase.advanced.AdvancedSimulationStep03
[4] computerdatabase.advanced.AdvancedSimulationStep04
[5] computerdatabase.advanced.AdvancedSimulationStep05
Gatling can only run with Jdk8. For windows, you can install multiple JDK as well. After install JDK8, go to your bin/gatling.bat, right click on that and select Edit.
Replace all %JAVA_HOME% with the your JDK8 path.
Example
%JAVA_HOME%\bin\java.exe
to
C:\Program Files\Java\jdk1.8.0_181\bin\java.exe
Make sure that you have the JAVA_HOME environment variable set.
On a Mac, you can type "env" in Terminal to show all of your environment variables. On Windows, type "set" in cmd to get a list.
You should see something like:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
You should first check your scala code and remove all the errors from your file/all the files, even if any one of the file has some issues then none of the test is going to get compiled and run.
Please check the package names and the file actually belongs to same package or not. [this was the issue in my case.]
Check indentation, it should not mismatch. [this was also there in my case]
Then you can check replacing JAVA_HOME in gatling.bat or gatling.sh file with the actual path as mentioned by some guys here.
Lastly you can change the JAVA_OPTS like mentioned by some one in above comments.[from -Xmx1G to be -Xmx512M]
This error may be caused by JAVA_HOME wrongly set.
Following Gatling documentation the system needs JDK8 to run:
https://gatling.io/docs/2.3/quickstart
Does not support JDK9 at the moment.
To check if you have JDK8 installed on Mac for example you can do:
# List Java versions installed
/usr/libexec/java_home -V
if you get:
Matching Java Virtual Machines (1):
9.0.4, x86_64: "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
Means that there is only JDK9 installed. Then you have to download and instal JDK8 (in Mac you can have several JDK installed), now the previous command returns:
Matching Java Virtual Machines (2):
9.0.4, x86_64: "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
1.8.0_171, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
and we can set JAVA_HOME with JDK8:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
After these steps running gatling.sh should not show the error anymore.
Add the next code to logback.xml
<root level="WARN">
<appender-ref ref="CONSOLE" />
</root>
And start gatling.sh
P.S. it's magical

How to create models in cakephp using the command prompt

I'm using cakephp to develop my project and I want to create models using the command prompt as that is easier than creating models manually. As I'm using the windows environment.
I edited the path in my computer/advanced settings/environment variable/system variable as below.
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin;C:\Program Files\TortoiseSVN\bin;C:\wamp\www\fit or fat\lib\Cake\Console;
(I have renamed my cakephp folder as fit or fat)
But whwn I enter the 'cake bake ' command in cmd I'm getting the error message that cake is not recognized as an internal or external command.
Is there anything else I have to do/
In Windows you need to use cake.bat instead just cake which is for *nix.
Also you can run bake without environment variables setting just do the following
cd "C:\wamp\www\fit or fat"
lib\Cake\Console\cake.bat bake
but you need to setup correct correct path to your php anyway.
If you want to just run bake without any setting do the following
cd "C:\wamp\www\fit or fat"
c:\wamp\php\bin\php.exe lib\Cake\Console\cake.php bake
please check path to your php executable, it can differ from mine c:\wamp\php\bin\php.exe

Resources