Results 1 to 5 of 5
  1. #1
    silvia is offline Member
    Join Date
    Jul 2007
    Posts
    35
    Rep Power
    0

    Default type javac on the command line from any directory of your machine

    I have a question. I did everything it said to install, and it gave me a test to see if everything was right, it said, "type javac on the command line from any directory of your machine."
    I assumed that meant go to start, then run and type in javac.
    However when I do that a Dos window or whatever it's called comes up for just a second, and then closes down.
    According to the tutorial it should come up with instructions on how to run javac.
    It might be doing that (there's several lines of writing that comes up when I do that) but it keeps closing down. If that is the right thing to do (going to start -> run -> type javac) then how do I get the window to stay up longer, if it's not the right thing to do what is?

    Thanks

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Javac is just a executable file used to run your *.java file. Have you check the bin folder on Java installation folder of your system. You can see that, it's just an exe file. You can't hold it. If you type javac on Run, it start to sun, and looking the *.java file. If it is not found such a file, close itself.

    If you have put the link of that tutorial, I check that what it says.

  3. #3
    vata2999 is offline Member
    Join Date
    Jul 2007
    Posts
    8
    Rep Power
    0

    Default

    I think after you setup your JDK you should set windows path in
    environment variables
    path=E:\Program Files\Java\jdk1.5.0_01\bin
    and set JAVA_HOME=E:\Program Files\Java\jdk1.5.0_01

    javac is java compiler it means you can compile java file from ms-dos prompt
    start -> run -> cmd
    javac filename.java
    after you compile your file javac generate class file
    to run class file
    java filename
    Last edited by vata2999; 07-19-2007 at 02:18 PM. Reason: MISSING SOMTHING

  4. #4
    cruxblack is offline Senior Member
    Join Date
    Jul 2007
    Posts
    130
    Rep Power
    0

    Default

    "type javac on the command line from any directory of your machine."
    it doesn't mean to type it from start->run, da command line means that u gotta write javac followed by .java extension file in the command prompt (cmd.exe in windows)

    U could find the command prompt from
    Start->All Programs->Acessories->Comand Prompt
    or u can just type cmd in the Start->run

    bout setting the environment variables, besides of what vata2999 just said, u can also do it from da command prompt
    just type SET PATH=%PATH%;<da path for ur jre or jdk bin folder right here>

    example : SET PATH=%PATH%;C:\Program Files\Java\jdk1.6.0\bin

    Initially if u dun change the location when u install java, thats the default location of ur java tools
    U can also set da classpath in da same way so that u can put all the source code (.java) u created in a specific folder and then just compile it using javac without having to write ur source code full address all da time

    hope this helps silvia ;)

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Another alternative I have to setup the path.

    WorkingFolder>path=c:\Program Files\Java\jdk1.6.0\bin

    But the easiest way is editing the AUTOEXEC.BAT file, if you are working on Notepad and Command Prompt.

Similar Threads

  1. Command line argument
    By denisatandi in forum New To Java
    Replies: 8
    Last Post: 10-17-2012, 12:37 AM
  2. Replies: 28
    Last Post: 10-26-2010, 05:39 AM
  3. Java command line
    By agouzoul in forum New To Java
    Replies: 2
    Last Post: 04-02-2008, 01:12 PM
  4. Exporting from the command line
    By o1121 in forum Eclipse
    Replies: 1
    Last Post: 08-09-2007, 08:29 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 01:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •