Question:
how to compile a java file using command prompt?
anonymous
2006-02-17 02:48:35 UTC
when i compile a java file named test.java from command prompt i got some error. As the file test.java was stored inside a subdirectory "c:\Program Files\Microsoft Visual Studio".
when i give like this(below) in command prompt i got error as invalid directory as it only takes the first word upto space.

C:>cd Program Files
Invalid Directory -Program

how to compile that file. please help me.
Four answers:
wenceslaus_dsilva
2006-02-17 04:55:43 UTC
install java sdk, n jre

goto cmd

path=%path%;C:\Program Files\Java\jdk1.5.0\bin;

type the above command in the command prompt

then try javac

if is shows soemthing the try ur java file dont close the command prompt

every time u need to comple n run u have to use the path command

or if u want a solution for once



right click my comp->propertitses(after installing java)

advance tab

enviromental variables then in system variables find the variable path n add the path where ur javac and java .exe files are stored the bin folder
anonymous
2016-05-20 04:27:05 UTC
Use the javac command followed by your program name: > javac MyProgram.java Make sure your Java bin path is set in your environment variables.
anilmathewm
2006-02-17 04:03:48 UTC
open command prompt. change dir to java bin then type cjava followed by file pATH and file name to compile.

eg

===========

>cd c:/java/bin

>cjava c:/tesat.java
Muruga
2006-02-22 09:03:09 UTC
Follow these steps...



http://www.leepoint.net/notes-java/background/10applications_and_applets/15compiling.html





http://www.michael-thomas.com/tech/java/javafirststeps/jemcompile.htm


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