Eclipse is not opening - java

I'm new to java and eclipse. I even saw this type of query on this website. But I have applied all those methods and it was also helpful. But when I try to open eclipse, it is not opening:
This is my path for java
C:\Program Files (x86)\Java\jre6
this is where my eclipse is
C:\Users\New folder\eclipse
But when I run the eclipse I'm getting an error
"A java rumtime environment(JRE) or java development kit(JDK) must be
available in order to run eclipse. No java virtual machine was found
after searching the following location: C:\Users\New
folder\eclipse\jre\bin\javaw.exe javaw.exe in your current path"
Please tell me the possible solution.
Thanks in advance!

If you have installed jdk then Eclipse won't have any issue to start. I think you just have installed JRE to run java programs. You need to install JDK.
To check whether you have installed JDK. Check Path C:\Program Files (x86)\Java. Your Java directory should contain directory jdk1.6.., If you don't have this directory there, search it at other places. If you did not find directory then you didn't install JDK.
Download JDK from here.

You should set JAVA_HOME and JRE_HOME variable. http://www.javawebonline.com/java-se-programming/beginners/java_home-jre_home-environment-variables/
And another suggestion is you should move your java home to another location and test your path to java such as
C:\Java\jre6
instead of
C:\Program Files (x86)\Java\jre6.

Go to C:\Users\New folder\eclipse
Open eclipse.ini file with text editor and add the javaw location there
( right after -vm part ) like so:
-vm
C:/Program Files/Java/jdk1.6.0_33/bin/javaw.exe <--- change to your path
-vmargs

Open the command prompt by pressing Windows+r, type cmd and press Enter.
Type javac and check the output.
If it gives all the options and usage, then you have configured the PATH vairables correctly, or else you have not set them up correctly.
Try it by checking the value at the command prompt.
NOTE
You need to open a new command prompt each time you change the environment variables.

If you have two Program Files folder in your C: drive
such as
C:\Program Files
C:\Program Files (x86)
then try to put your java inside
C:\Program Files
instead of C:\Program Files (x86)

It seems you are running 64 bit eclipse in 64 bit operating system. If you are running 64 bit eclipse then you need 64 bit JDK. Please install 64 bit JDK and run eclipse.

Related

My simple Java program runs with no problem on Eclipse, however can't find Java in my pc

I have a Windows laptop provided by my employer. I don't have admin rights. I was able to download Eclipse for Java and run a very simple program that printed to the console "hello world". However, I'm not able to find the Java files. I used the cmd command java -version and it does not recognize it. I looked in the Local disk > program files, and didn't find Java there either. Can someone explain what is going on?
Long story short:
Eclipse has it's own compiler, it does not use the JDK compiler.
So it makes perfect sense that Java is not installed but yet you are able to run the code from Eclipse.
You can only use command "java -version" in console if the windows system variable Path contains the "path" to the folder where java is located.
ie:
variable: Path
value: C:\Program Files\Common Files\Oracle\Java\javapath
Go to system properties and look for environment variables.
Try to go to eclipse folder and you will see jdk ,java and other files. Copy that java folder path and run command java -version in a Terminal

Eclipse stating that isntall directory is location of JAVA_HOME

I was trying to setup a workspace for modding in Minecraft, and got a error stating that my JAVA_HOME directory was not found. After messing around and installing a new JDK, running Eclipse states that:
"A Java Runtime Enviroment (JRE) or Java Development Kit (JDK)" must be avaiable in order to run Eclipse. No Java virtual Machine was found after searching the following locations: C:\Users\|My Username|\Desktop\Eclipse\jre\bin\javaw.exe
javaw.exe is your current PATH"
I was checking my PATH and JAVA_HOME variables, which where both set to C:\Programm Files(x86)\Java\jdk1.8.0_51
The file eclipse is looking for is the standart directory where java stores its javaw.exe, i.e Java\jdk1.8.0_51\jdk\bin\jawaw.exe, but Eclipse is somehow thinking my path is set to the Eclipse installation directory. Does anyone know how to fix this issue?
It is a bad idea to have JAVA_HOME set to a folder in "c:\program files..." because of the space in the folder name. Whenever this value is used as a command line argument, the receiver would interprete it as two arguments ("C:\program" and "file...").
Move your jdk into a folder without space in the name, and correct your JAVA_HOME variable.
BTW: eclipse resolves first the system PATH variable in order to find a suitable java SDK. It's a good practice, to declare the desired SDK in the eclipse.ini file (in eclipse install-folder). Add there an argument:
....
-vm
C:\JDK8\bin\javaw.exe
-vmargs
-Xms40m
-Xmx384m
Note that the -vm arg and its value must appear on separete lines and must be placed just before the -vmargs argument.

Windows 7 command line jps not working

Others have asked this question but the answer is usually the same and not helpful to my problem. I installed JDK, and added C:\Program Files\Java\jdk1.7.0_25\bin to the path system variable. I checked, jps.exe is in that directory. I restarted my computer but still have had no luck. When I run jps I get the error:
'jps is not recognized as an internal or external command, operable command or batch file'
When I run C:\Program Files\Java\jdk1.7.0_25\bin\jps.exe on the command line it works fine. Working in Windows 7.
Mildly obvious mistake, but I realize that I had spaces in between the directories in my path and that caused them to not be recognized. So I had %OTHER_PATH%; C:\Program Files\Java\jdk1.7.0_25; %ANOTHER_PATH%, which I just had to switch to %OTHER_PATH%;C:\Program Files\Java\jdk1.7.0_25;%ANOTHER_PATH%
Your JDK bin directory does not exist in PATH variable.
To add this you need to do below steps.
Go to "Control Panel >> System >> Advanced system settings >>
Environment Variables
Click 'Path' from System variables
Click Edit.
Now add the path "C:\Program Files\Java\jdk1.8.0_72\bin"
Now open command window and write jps. It will work now.
In addition to the above solutions, still if you have issue with jps command, Please check whether the default system installed java(JRE) path is already available in the Path variable.
My case i faced the same issue and observed the following path already available in the path variable.
"C:\Program Files (x86)\Common Files\Oracle\Java\javapath"
So I had to change the position(move up) of my new JAVA_HOME path, new JAVA_HOME path is above the default oracle javapath.

Javac is not found

I'm running Windows 8 and I can not get javac to work.
I have set my PATH in environmental variables to
C:\Program Files (x86)\Java\jdk1.7.0_17\bin
I have tried both with and without ';' but to no avail.
I recently had this issue on my desktop and adding ; worked but it's not in this case.
I have made sure that javac does exist in the bin too.
Any suggestions on fixes would be greatly appreciated.
EDITS
echo %PATH% gives:
C:\Users\Arktri\Desktop>echo %PATH%
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
C:\Windows\system32;C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;;
C:\Program Files (x86)\Java\jre7\bin
And the exact error is: 'javac' is not recognized as an internal or external command, operable program or batch file.
As far as I can see you have the JRE in your PATH, but not the JDK.
From a command prompt try this:
set PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.7.0_17\bin
Then try javac again - if this works you'll need to permanently modify your environment variables to have PATH include the JDK too.
Go to my computer;
Right click properties;
Go to advanced system settings;
Go to environment variables;
In user variables for user click on new(top new button, not on system variables);
Set variable name as: Path
Set the value of that variable to: C:\Program Files\Java\jdk1.7.0_76\bin
Click ok;
Click ok;
Click ok.
Now you're set. Type javac in cmd. All javac options will be displayed.
EDIT: As #MediaMaker pointed out, after completing the above steps, you need to open a new command prompt for it to work.
Easiest way: search for javac.exe in windows search bar. Then copy and paste the entire folder name and add it into the environmental variables path in advanced system settings.
I'm searched many answers that suggest me to type in cmd:
set path = "%path%;c:program files\java\jdk1.7.0\bin"
but this is WRONG!
the right solution is that you leave "set" and just type
path = %path%;c:program files\java\jdk1.7.0\bin
P/s: of course you have to replace "jdk1.7.0" folder by your current java version folder. This works well on win 7 32bit, but I think it also works on win 8 - try it!
Start off by opening a cmd.exe session, changing directory to the "program files" directory that has the javac.exe executable and running .\javac.exe.
If that doesn't work, reinstall java. If that works, odds are you will find (in doing that task) that you've installed a 64 bit javac.exe, or a slightly different release number of javac.exe, or in a different drive, etc. and selecting the right entry in your path will become child's play.
Only use the semicolon between directories in the PATH environment variable, and remember that in some systems, you need to log out and log back in before the new environment variable is accessible to all environments.
You don't have jdk1.7.0_17 in your PATH - check again.
There is only JRE which may not contain 'javac' compiler.
Besides it is best to set JAVA_HOME variable, and then include it in PATH.
do this:
1. run CMD (WIN+R then type in CMD)
2. Type this:
set PATH=%PATH%; java installation path\bin
Replace "java installation path" with the directory JDK is installed in, such as C:\Program Files (x86)\Java. Be sure to add the \bin after the JDK directory, because this points to "javac" and "java" (BIN stands for "binaries")
This way, you can run the Java compiler from anywhere. It is impossible to CD to the JDK directory because it has a space in Program Files, and DOS will not let you CD to these directories.

Can't find ports with javax.comm api

I am trying to install the javax.comm api on a machine (I already installed on another machine and it is working fine) but when I run the sample "BlackBox" application I get a message that says "No serial ports found!". I have followed the instructions and put win32com.dll in the bin directory of the jdk, comm.jar in the lib directory of the jdk, and javax.comm.properties in the lib directory of the jdk. I have also added the comm.jar file to the classpath since i am using a jdk and not jre. All this and I still can't get BlackBox to find any serial ports. Can anybody help me with this?
There's a jre directory in your JDK directory. Use <jdk>/jre/lib, not <jdk>/lib. Also, if you've added another copy of comm.jar, located elsewhere, explicitly to your classpath, take it out.
You might want to add a System.out.println(System.getProperty("java.home") statement to your code to make sure that you are placing things in the right directory; even when you are running <jdk>/bin/java, the java.home property should be <jdk>/jre.
It works fine on my Windows XP (32 bit) and jdk1.6.0_21 as follows:
1) Set the environment variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_21
Path=...;C:\Program Files\Java\jdk1.6.0_21\bin;
2) Install three files:
C:\Program Files\Java\jre6\lib\comm.jar
C:\Program Files\Java\jre6\lib\javax.comm.properties
C:\Program Files\Java\jre6\bin\win32com.dll
3) Run from terminal as follows:
cd commapi\samples
java -classpath "C:\Program Files\Java\jre6\lib\comm.jar";BlackBox\BlackBox.jar BlackBox

Categories

Resources