Question:
TROBLED IN COMPILING & RUNNING JAVA PROG!!?
a2yu_k
2010-03-21 08:34:57 UTC
I M GIVING OUT WHAT I HAVE BEEN DOING:
1.I INSTALLED JDK FRON SUN MICRO SITE.I GOT THIS SOFTWARE DOWNLOADED jre-6u18-windows-i586-s.exe
2.I INSTALLED IT IN C: DRIVE.PATH IS C:\PROG FILES\JAVA\JRE6
3.I WROTE A CORRECT SAMPLE PROG FROM BOOK SAVED IT IN NOTEPAD.PATH IS C:\JAVA
4.I OPEN COMMAND PROMPT,TRY TO COMPILE FILE javac Test.java & always it says sth like javac is not recognised internal or external batch file...bla..bla...
5.I FIGURED OUT FROM SUN MICRO SITE CORRECTED PATH TO LOCATE JAVAC COMPILER BUT NOTHING WORKS.
PLZZZZ HELPPPP
Five answers:
Arpita
2010-03-21 21:22:59 UTC
You said u downloaded jre-6u18-windows-i586-s.exe

JRE is java runtime environment.. It is used for running compiled java programs.. It won't have javac.exe for compiling .java source files.. For that download and install JDK (java development kit)..



Then add bin folder of jdk to path variable in environment variable.. Also add classpath "." if not there
kenniston
2016-10-16 02:57:18 UTC
Are you advantageous you downloaded and put in the JDK and not the JRE? you're in all possibility universal, however the JRE is in basic terms the JVM runtime itself and would not contain the java compiler, whilst the JDK includes the compiler, runtime, and greater. i do no longer think it incredibly is mandatory to function or alter any atmosphere variables, till you like to collect and run java bytecode via command line. ultimately, in case you're attempting to collect and run java code interior of textpad, i might advise utilising an easily IDE and something slightly greater effective like Eclipse or Netbeans (the two one among that are loose).
Neeraj Yadav♄
2010-03-22 08:58:33 UTC
I have suggested to many peoples about to use



IDE for faster and hassle free developement



where you really can work on logic rather than working on these hidden configuration issues.



Download eclipse and start working on it ,i bet you can thank me for this suggestion



Other light wieght java IDE are also available

Recommended to beginners



http://www.jcreator.com/

http://www.bluej.org/

http://drjava.sourceforge.net/





BTW, answering to you original answer



Developers are supposed to have JDK installed.



To Install the JDK Software and Set JAVA_HOME on a Windows System



1. Install the JDK software.

1. Go to http://java.sun.com/javase/downloads/index.jsp.

2. Select the appropriate JDK software and click Download.



The JDK software is installed on your computer, for example, at C:\Program Files\Java\jdk1.6.0_02. You can move the JDK software to another location if desired.

2. To set JAVA_HOME:

1. Right click My Computer and select Properties.

2. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.6.0_02.





Note: if you dont want this hassles go for lightwieght IDE and just concentarte on programming.

Using IDE can be easily looked after in youtube video or so search it in a minute or two you will

be ready to code on ide so why to waste time?



Hope this helps

Cheers
Lost in Life
2010-03-21 08:52:55 UTC
check the class path variable settings.



Right Click on My Computer--->Advanced---->Environment Variables



Click on "New"



Variable Name = CLASSPATH



Value = C:\PROG FILES\JAVA\JRE6



The class path should be the same as your directory in which you have stored your Java Program.



eg:- C:\PROG FILES\JAVA\JRE6 in your case.

You have to run all your programs from this path only. If you intend to run from other path, you have to change the classpath settings.
a
2010-03-21 09:05:59 UTC
You are not setting the path properly that is why it is resulting in error

there are two ways to do it :

one using dos prompt,using environment variables



Folder where program is saved C:\JAVA



dos prompt:

set path="C:\Program Files\Java\jdk1.6.0_17\bin";

set classpath=%classpath%;.;



environment method:

My Computer->Right Click->Properties->Enviroment Variables

User Variables->New ->Give variable name PATH->variable value->C:\Program Files\Java\jdk1.6.0_17\bin;(no quotes)



I would suggest using environment variables because you wont have to set the path in the dos prompt again and again


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...