Windows JAVA HOME problems - windows

I'm trying to experiment with OracleHelp for Java on my Windows Vista server. I downloaded Oracle help, and I'm following their installation instructions which states:
Unzip the OHJ installation .zip file into a directory of your choice
Ensure that you have the JAVA_HOME environment variable set to the location of your compatible Java SE installation
In the OHJ installation directory, there is a bin subdirectory containing Windows .cmd files and Unix/Linux shell scripts. On Windows platforms, double click on the .cmd files to launch them (or type the .cmd file name on the command line). On Unix platforms, type "sh scriptName.sh" to execute the shell scripts.
ohguide.cmd (ohguide.sh) - launches the Oracle Help Guide documentation
choiceDemo.cmd (choiceDemo.sh) - launches a demo of Oracle Help features
cshDemo.cmd (cshDemo.sh) - launches a demo of context sensitive help
helpsetDemo.cmd (helpsetDemo.sh) - launches the Helpset Previewer for testing your helpsets
authoringWizard.cmd (authoringWizard.bat) - launches the Helpset Authoring Wizard
When I set JAVA_HOME on windows I can set it with or without quotes. Either way fails :
with quotes:
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>set JAVA_HOME="C:\Program
Files (x86)\Java\jdk1.6.0_14"
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>ohguide.cmd
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433>""C:\Program Files (x86)\Java\
jdk1.6.0_14"\bin\java.exe" -classpath "ohj.jar;help-share.jar;oracle_ice.jar;jew
t.jar;share.jar;help-demo.jar" oracle.help.demo.ChoiceDemo "demodoc\ohguide\ohgu
ide.hs"
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
without quotes:
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>set JAVA_HOME=C:\Prog
iles (x86)\Java\jdk1.6.0_14
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>ohguide.cmd
'Files' is not recognized as an internal or external command,
operable program or batch file.
No Java Virtual Machine found; please set JAVA_HOME environment variable.

The problem is caused by the blanks embedded in your JAVA_HOME. When I install the JDK on Windows, I override the installation location with a directory path that does not contain any blanks. There are still a surprising number of tools that cannot deal with blank spaces.
In your particular case, the problem caused by an inconsistency between _init.cmd and ohguide.cmd. In one place, they have double quotes around a use of OHJ_JAVA_HOME and in the other case, they do not have double quotes.
But there is a solution - use the shortened name for the directory. You can find the name using the DIR /X command in a DOS window. For example, on my system "C:\Program Files" has the short name "C:\Proga~1". You can use this value when setting JAVA_HOME, without any quotes. e.g.
set JAVA_HOME=c:\progra~1\java\jdk1.6.0_14

I set it in Windows System Properties and that works fine.
On Vista:
Click the Start button (windows logo, lower left corner)
Right-Click Computer
Select Properties
Select Advanced system settings (options on the left)
Select Environment Variables (button)
Add (or edit) a System Variable JAVA_HOME
Enter your JAVA_HOME without any quotes
Add to the PATH System Variable to include the path to your JDK (so you dont have to worry about how to quote it.
You may also want to extend your CLASSPATH System Variable to include the ones you would specify on the command line (optional)

In both scenarios you are using one too many quotes when you try to call the java exectuable.
In your code this:
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433>""C:\Program Files (x86)\Java\
jdk1.6.0_14"\bin\java.exe" -classpath "ohj.jar;help-share.jar;oracle_ice.jar;jew
t.jar;share.jar;help-demo.jar" oracle.help.demo.ChoiceDemo "demodoc\ohguide\ohgu
ide.hs"
should be:
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433>"C:\Program Files (x86)\Java\
jdk1.6.0_14\bin\java.exe" -classpath "ohj.jar;help-share.jar;oracle_ice.jar;jew
t.jar;share.jar;help-demo.jar" oracle.help.demo.ChoiceDemo "demodoc\ohguide\ohgu
ide.hs"

Related

Why does spark-shell fail with "'""C:\Program' is not recognized as an internal or external command" on Windows?

While running the following command prompt I am getting the error as in the screenshot.
Command:
c:\spark>spark-shell
Error:
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Why?
Suprit,
The issue is most likely with the space in your JAVA_HOME.
If the path contains spaces, use the shortened path name. For example, C:\Progra~1\Java\jdk1.8.0_131
If you are using Windows10. please try the below
Set JAVA_HOME as "C:\Progra~1\Java\jdk1.8.0_131"
Also make sure you have included %JAVA_HOME%\bin in your PATH environment variable.
I suspect that you installed Java to a directory with a space so JAVA_HOME breaks spark-shell script on Windows.
Make sure you install Java to a directory with no space in the path.
The other option would be to set JAVA_HOME to the same value but wrapped with double quotes, e.g.
set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_131"
That will likely lead to the other issue on Windows that was answered in Why does spark-shell fail with "was unexpected at this time"? that's simply to re-install Java to a directory with no space in the path.
The thing I could not check out yet would be to wrapped JAVA_HOME using single quotes (not double quotes). That in theory would help pass the line with comparison to "x".
First you gotta find out where is your JAVA_HOME. In my case it is, "C:\Program Files\Java\jdk1.8.0_25\bin\java"
Then open your file called spark-class2.cmd, locate and change to your java home path (change only the bold text below).
Additional text are included for completeness only.
"C:\Program Files\Java\jdk1.8.0_25\bin\java" -Xmx128m -cp "%LAUNCH_CLASSPATH%" org.apache.spark.launcher.Main %* > %LAUNCHER_OUTPUT%
for /f "tokens=*" %%i in (%LAUNCHER_OUTPUT%) do (
echo %%i
set SPARK_CMD=%%i
)
del %LAUNCHER_OUTPUT%
%SPARK_CMD%
I had same issue. I uninstalled java and installed in C:\Java folder , changed the required env settings and it just worked for me!!!
I had the same problem.
It happens with version spark-2.1.1-bin-hadoop2.7 but not with the previous version spark-2.1.0-bin-hadoop2.7.
Edit line 54 of spark-2.1.1-bin-hadoop2.7/bin/spark-class2.cmd by removing the quotes as:
set RUNNER=%JAVA_HOME%\bin\java
Then it should work.
Somewhere you have set a path or variable without wrapping it in double quotes. Hence the path is being split on the first space.
C:\Program Files\Whatever
has become...
C:\Program
To fix it you need to make sure you wrap path variables in double quotes.
i.e
C:\Program Files\Whatever\Foo\My Bar\bin
should be
"C:\Program Files\Whatever\Foo\My Bar\bin"
or even better use environment variables for user paths. e.g.
"%PROGRAMFILES(X86)%\Whatever\Foo\My Bar\bin"
"%PROGRAMFILES%\Whatever\Foo\My Bar\bin"
You need to set the Environment variable to use spark-shell from any directory.
Or you need to go inside bin folder to execute spark-shell command
in my case its inside /spark/spark-2.0.2-bin-hadoop2.7/bin/
I was getting same error after set all path.
So you have type Space spark-shell
c:\spark> spark-shell
it will work
Follow to my step
Download JDK 8 for windows
Install Java Development envioronment
Download Spark with latest version with prebuilt Hadoop
Download WinRar for extracting
Make folder in C derive put spark folder
Go to Conf folder in Spark
Change format of log4j.propreties
Open Log4 .. in word
Replace INFO to Error
Save that file
Download Winutils
Create new folder as Winutils in C derive
Paste download winutils file in bin folder
Set Environment in Windows
Control Panel
Click on System and Security
System
Advance System Setting
Environment variables
( Set Spark Home)-New
New User_ Variables Form
Variable _Name- SPARK_Home
Path:- C:\Spark ( Spark foder in C derive)
(Set Java Home )- New
JAVA_HOME
Java Folder path –(1st java folder)
Set Hadoop path –
HADOOP_HOME
Path- C:\Wintulis
Path Directories
PATH- Edit
New- %SPARK_HOME%\bin
NEW- %SPARK_HOME%\bin
System Environment Done
You have to set the path of spark in the environment variables by following this or any other tutorials.
Another option is to go into the directory that contains the spark-shell and execute it directly.
Hope this help, Best Regards

'jmeter' is not recognized as an internal or external command, operable program or batch file

When i run my JMeter script on commandline mode, i am getting below error.
But the same script is running perfectly fine on GUI mode.
Need some help here to fix this.
Below is the error:
C:\Users\Sundarapandiyan>jmeter -n -t D:\JMETER\apache-jmeter-3.1\bin\My Projects MyFirstUIRecordBadBoy.jmx -l \JMETER\apache-jmeter-3.1\bin\My Projects CSVSample_user.csv
'jmeter' is not recognized as an internal or external command,
operable program or batch file.
As Dave L mentioned, add the Jmeter installation bin directory to the system path using My Computer > properties > Advanced System settings > Environment variables > Under system variables, select PATH > Add D:\JMETER\apache-jmeter-3.1\bin to your path at the end.
Please note, windows only considers the jmeter.bat file even when you run jmeter. It won't run the plain jmeter file available under the installation path.
To directly run a program on the command line it needs to be either included in the environment PATH; in the same folder; or specified by full path.
To use JMeter via command line you can either:
Add the folder containing JMeter to your PATH (see https://www.java.com/en/download/help/path.xml) for how to do this across Windows versions, it's quite generic despite saying JAVA)
Run it directly from the JMeter folder (in your case D:\JMETER\apache-jmeter-3.1), this is the easiest option for you.
You can do this by either Shift+Right Clicking in the folder & using 'Open command window here') or;
Changing to the directory via command line
You can change drive & directory on the command line using:
D:
cd D:\JMETER\apache-jmeter-3.1
If we have space in folder name, the path will get break and you won't be able to run the file.
To overcome this, please use double quotes in the full path.
Example:
C:\Users\Sundarapandiyan>jmeter -n -t "D:\JMETER\apache-jmeter-3.1\bin\My Projects" MyFirstUIRecordBadBoy.jmx -l "path_to_jtl_file"
And also add complete path of jmeter. example:
C:\Users\Sundarapandiyan\Jmeter_folder\bin\jmeter -n -t [rest of the command]
If you are trying to run JMeter from the command line and are getting an error message stating that “‘jmeter’ is not recognized as an internal or external command, operable program or batch file,” it means that JMeter is not in the system path and the system is unable to find it
To solve this issue, you will need to add the path to the JMeter installation to the system path. Here are the steps you can follow:
First, locate the installation directory for JMeter. By default, this is usually “C:\apache-jmeter-X.X\bin” (without the quotes), where X.X is the version number of JMeter
Next, go to Start > Control Panel > System and Security > System
Click the Advanced system settings link on the left side of the window
Click the Environment Variables button
Under the System variables section, scroll down and find the Path variable
Click the Edit button
Add the folder location to the Path env variable

Note: do not delete any existing values. In case you are using older Windows OS
Add the path to the JMeter installation to the end of the Variable value field. For example, if JMeter is installed in “C:\apache-jmeter-X.X\bin,” you would add “;C:\apache-jmeter-X.X\bin” (without the quotes) to the end of the field
Click OK to save the changes
After following these steps, the system should be able to find JMeter and you should be able to run it from the command line without any issues

How to run application from command prompt with arguments?

I have an application named DriveMaster which I want to run from command line with different arguments. The application is residing in:
"C:\Program Files (x86)\ULINK DM2012 PRO NET\v970\DriveMaster.exe\"
Now in Windows - Run, if I open command prompt and want to give a command like:
DriveMaster /s:Scriptname.srt
This should be able to launch DriveMaster with that particular script.
How can I do this? What should I need to add in the Environment variables so that I can run the application from command prompt?
In Windows 7:
In the menu Start click Computer
In the context menu, select System Properties
Select Advanced System Settings -> tab Advanced
Select Environment Variables Menu System Variables to find the PATH variable and click it.
In the editing window, change the PATH, adding value: ; C:\Program Files (x86)\ULINK DM2012 PRO NET\v970
Open Run and type: DriveMaster /s:Scriptname.srt
That's all.
When you're in the command prompt the working directory is given in the prompt:
C:\Users>
Here, I'm in the folder C:\Users. If I want to run a program or a script in the folder I'm currently in, I can use its name alone (e.g. DriveMaster). If the program is outside my working directory, I can't call it like that because there could be many DriveMasters in different folders throughout my computer. I can either change my directory to be the one that has this program, or I can specify where in the filesystem it's located.
Changing the directory and running:
C:\Users> cd "C:\Program Files (x86)\ULINK DM2012 PRO NET\v970\"
C:\Program Files (x86)\ULINK DM2012 PRO NET\v970> DriveMaster
Specifying the full path:
"C:\Program Files (x86)\ULINK DM2012 PRO NET\v970\DriveMaster"
(I need to use quotes here because the folder names have spaces and my command prompt may not know if it's part of the folder name or the beginning of another command or argument.)
On the same line I call the program, I can choose a number of arguments (also called options, switches, flags) to change the way to program behaves. If my program accepts another file and wants it in the form /s: and-then-the-filename, that file also needs to be in my working directory. If it lives somewhere else, I can use the full specification, like I've done above.
Environment variables are a little more complicated of a topic, but there is one we might be interested in here. The Path environment variable is a list of folders that the command prompt will look in when you try to use names of files that aren't in your working directory. If I know I'm going to be using this program frequently and like where it is, I can add its folder to my Path so that I can access it with just DriveMaster in the future:
set PATH=%PATH%;C:\Program Files (x86)\ULINK DM2012 PRO NET\v970
(If I mistype that command, though, I could break other things in a way that would be hard to fix.)
In a file name drivemaster.bat whch would be located at some point in the path,
#echo off
setlocal
"C:\Program Files (x86)\ULINK DM2012 PRO NET\v970\DriveMaster.exe" /s:Scriptname.srt
where Scriptname.srt would need to be quoted and supplied with a full pathname if it's not in the current directory.
Oh you want to type DriveMaster /s:Scriptname.srt
Then use
"C:\Program Files (x86)\ULINK DM2012 PRO NET\v970\DriveMaster.exe" %1
in that script in place of the original "c:..." line.
edit : removed stray terminal backslash from ...exe

javac is not working even after setting the path in windows xp

Friends I couldn't access java in my xp even after i set the path
i set the path as set path="C:\Program Files\Java\jdk1.7.0_25\bin"
It doesn't work in xp But it is useful in my windows 7 System
Don't know why
Please answer me
I also set path variable in the environment variables tab.But that doesn't worked for me
Still my javac command says javac is not recognised external or internal command.
So please help me
Run this command in Command Prompt/CMD
set path="%path%;c:\program files\java\jdk1.7.0_25\bin"
If you already have a instance of terminal opened, you'll have to close it and re-open for work. Make sure this path C:\Program Files\Java\jdk1.7.0_25\bin is valid and has javac.
1>First check if java is really installed in your PC.
You can do this by going to
C drive->Program Files->Java
Inside java you should have two folders
1. jdk
2.jre
2> copy the path C:\Program Files\Java\jdk1.7.0_25\bin
(jdk1.7.0_25 is the jdk version you have installed as you mentioned)
3>Go to advanced system settings and click on Environment variables
4>Click on new and you will have two fill the variable name and variable value.
type in " PATH " (without the double quotes and in CAPS) in the variable name
and paste the copied path in the variable name field.
5>Now open a new command prompt and type javac.
You should see a list and not the error you mentioned.
Another way..but this way is only a temporary solution since once you close cmd you will have to set path again.
You can even set path= (paste the path you copied after the equals sign)
First follow these steps
Start -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH.
If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Close the window.
Reopen Command prompt window, and run your java code.
now Run where java. this should return java path up to java.exe
If still you are having issues leave a comment

ActivePerl Installation on Windows operating system

I have installed ActivePerl on my Windows OS. I have followed below URL
procedure to install
ActivePerl Installation
After having done that, I have tried to run "perl -v " on the command line. But it reports the following error.
The system cannot execute the
specified program
What do I need to do to solve these issues?
I was facing a similar issue... but the thing was that I could execute the file by right clicking the file and opening it with perl command line interpreter.... but still the perl-v command would give the error... all I had to do was execute this command
set PATH=C:\Perl\bin;%PATH%
This solved the issue...
You need to make sure the directory where the Perl executable lives (it might be C:\perl\bin, but basically wherever you told ActiveState Perl to be installed) is in your PATH environmental variable (you can find the variable value by typing set PATH command on command line prompt in Windows).
If you're not sure where you installed Perl to (and can't find it in the default C:\perl\bin), you can find the directory by going to Start menu, finding ActiveState Perl folder, and right-clicking on "Perl Package Manager" icon, then pick "Properties" from the right-click menu. Properties window (in the "Shortcut" tab) will have a "Target" line showing the directory.
I was getting a similar error after installing ActiveState Perl on Windows 8 x64 bit edition and trying to invoke 'perl' at the command line.
'perl' is not recognized as an internal or external command, operable
program or batch file.
I remember selecting the option during installation to add the Perl directory to the system PATH environment, and after checking the system properties, it was indeed showing in the system PATH.
I tried installing 'Microsoft Visual C++ 2008 x86 and x64 redistributable setup' files as suggested by a few places but it still did not resolve the issue, until I tried some of the suggestions in this thread.
At the command prompt I entered:
set PATH
And surprisingly it did not list the Perl directories as being included in the PATH variables.
So to remedy that I entered this into the command prompt and hit enter:
set PATH=C:\Perl64\bin;C:\Perl64\site\bin;%PATH%
(The directory paths are for the 64 bit edition of Perl, adjust according to your installation) the %PATH% portion is important and ensures your existing settings are kept and not wiped out and overwritten when you set the PATH.
That fixed it and entering 'perl -v' into command prompt successfully replies your Perl version. If you had a PowerShell window open before setting the PATH variable, you will need to close it and re-open another instance of PowerShell.
I believe the original underlying issue was something to do with different PATH variables for 32-bit and 64-bit environments and possibly some internal Windows redirection that takes place automatically.
This doesn't sound like a problem with PATH - I would expect it to give the message 'perl' is not recognized as an internal or external command, operable program or batch file.
I have not seen this error message, but http://nirlevy.blogspot.com/2008/03/system-cannot-execute-specified-program.html makes some suggestion for related programs.
Or maybe ask on an Active State forum.
I had the same error. I was able to solve it by changing the order of the Perl64 entries in the PATH variable in the Environment Variables. I moved the C:\Perl64\bin to be before C:\Perl64\site\bin and it worked.
I had a similar error which was solved by adding the .pl extension to the script name, which I had forgotten to do.
I could not get it to work otherwise even with my Perl's location (C:\Apps\Perl\bin) verified as in %PATH%.
The problem lies in the installation directory.
The Perl PATH variable will be set to C:\Program Files\perl (depends on 32 or 64 bit of course), BUT, the default installation directory is C:\perl. This is kind of sneaky actually as you would assume the installer would be more intelligent about this, but it sets the environment variable to that directory no matter WHERE you install the damned thing.

Resources