English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Ok, i am trying to run an example program in our book..i am new to programming java..
i write the program in a notepad and saved it in a folder "bin"..

(in command prompt)
C:\Program Files\Java\jdk1.6.0_01\bin>

when i entered javac filename.java in this prompt,
it says that 'javac' is not recognized as an internal or external command..
what does it mean?
and when i tried entering filename.java in this prompt, the notepad shows up..and that's all. it didn't show the output of the program. please help me with this. i just want to learn.

i am using the jdk1.6.0_01..

2007-12-11 23:37:24 · 4 answers · asked by aquariusXgirL 2 in Computers & Internet Programming & Design

4 answers

Try this link for details. I would add this to your favorites too as you may need the other assistance here also.

Add the full tutorial to favorites too. Spend some time going through it.

2007-12-11 23:55:41 · answer #1 · answered by AnalProgrammer 7 · 0 0

You need the Java runtime (JRE) to be installed on the computer, no matter what. That has just the files needed to run Java. You can test that in advance. Fire up the command prompt on the computer you want to use, and then enter: java -version If you get a response like: java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing) ...then you have Java installed and know the version. If you get a message like "'java' is not recognized as an internal or external command, operable program or batch file." then Java is either not installed or not installed properly. You don't need the Java Development Kit (JDK) and you don't need NetBeans, Eclipse or any other development tools. All you need is the class files, possibly packed into a JAR file. If you're just running from the command line, copy *.class from your working directory to the the USB drive. If you are compiling with NetBeans or Eclipse, either of those automatically pack everything the app needs into a JAR file. In NetBeans, it's stored in the "dist" subdirectory as "yourprojectname.jar". Just copy that to where you need it. With Eclipse, use the File>Export... and specify "Java>JAR File" in the window under "Export Destination" and click Next. Under "Export destination", click "Browse...", navigate to the folder where you want to put the JAR file, type a name with a .jar extension in the file name box (won't exist the first time), like "MyApp.jar" or something, and then click Finish. Since you have a console program, odds are that Windows is not set up to run a JAR or Java .class file with a console. You need to add one little bit to make it "clickable". A three line batch file, maybe named "MyApp.bat". Running from .class files, it will look like: @echo off java MyMainClass %* pause Running from a JAR file: @echo off java -jar MyApp.jar %* pause Now you should be able to just double-click on the batch file. The pause command will keep the screen from closing at the end of the run, prompting you to press a key first. Maybe your app doesn't need that, but it's a nice bit to have if you have an unexpected problem. You'll get to see and maybe copy/paste the exception message for debugging.

2016-05-23 04:55:55 · answer #2 · answered by machelle 3 · 0 0

You must not get the error if you are giving the javac command after navigating to bin folder in command prompt.

However just try doing this: Add a system variable called JAVA_HOME with value C:\Program Files\Java\jdk1.6.0_01 to your environment variables.

2007-12-11 23:56:18 · answer #3 · answered by Asty 2 · 0 0

Eclipse.org home

2007-12-11 23:40:43 · answer #4 · answered by Anonymous · 0 2

fedest.com, questions and answers