Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 14 of 14

Thread: Problem of executing java.exe. How to code from absolute scratch?

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem of executing java.exe. How to code from absolute scratch?

    I've been reading herbert schildts "java for beginners" and it says in order to compile raw code, i should open javac.exe, and type in x command.

    however when i load javac, it appears, loads up the help console, but disappears before i can do anything. i've tried running it as an administrator, i've tried turning my antivirus software off, but nothing makes a difference.

    Up to now i've been using the netbeans IDE to do all of my coding, but i wanted to learn how to code from absolute scratch.

    Any help would be much appreciated.

    Simon


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: javac.exe problem

    Hey sepalm,

    Please take a look at these links. It should help:

    javac.exe : Java Glossary

    "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)

    If you are still having problems after reading this then reply here and we will see what we can do...
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  3. #3
    Banned
    Join Date
    May 2008
    Posts
    25
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: javac.exe problem

    Quote Originally Posted by sepalm View Post
    I've been reading herbert schildts "java for beginners" and it says in order to compile raw code, i should open javac.exe, and type in x command.

    however when i load javac, it appears, loads up the help console, but disappears before i can do anything. i've tried running it as an administrator, i've tried turning my antivirus software off, but nothing makes a difference.

    Up to now i've been using the netbeans IDE to do all of my coding, but i wanted to learn how to code from absolute scratch.

    Any help would be much appreciated.

    Simon


    if you are using windowsxp~ you can do -> run -> cmd -> javac - parameters.

  4. #4
    Junior Member
    Join Date
    Jul 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: javac.exe problem

    Unfortunately i'm using vista.

    I've got the same tutorials pretty much, problem is, executing javac.exe.

    C:\Program Files\Java\jdk1.6.0_03\bin\javac.exe

    I open it, and the cmd prompt opens, displays (what i presume is the help console) and disappears before i can type anything.

    Any ideas? wouldn't be anything to do with not having the most up to date java would it?

    Simon

  5. #5
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: javac.exe problem

    Quote Originally Posted by sepalm View Post
    Unfortunately i'm using vista.

    I've got the same tutorials pretty much, problem is, executing javac.exe.

    C:\Program Files\Java\jdk1.6.0_03\bin\javac.exe

    I open it, and the cmd prompt opens, displays (what i presume is the help console) and disappears before i can type anything.

    Any ideas? wouldn't be anything to do with not having the most up to date java would it?

    Simon
    Im not sure if you can run javac.exe like that. I think you need to open a command window (Start > Run > CMD) and navigate to:

    C:\Program Files\Java\jdk1.6.0_03\bin\

    using the 'cd' command to change directories then type javac.exe

    It should load up OK then...
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  6. #6
    Junior Member
    Join Date
    Jul 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: javac.exe problem

    I apologise for being a dunce, as i've only used IDE's i never knew that.

    Thanks alot for the help

  7. #7
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: javac.exe problem

    No problem!

    If you have any further questions then be sure to post back
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  8. #8
    Banned
    Join Date
    May 2008
    Posts
    25
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: javac.exe problem

    Quote Originally Posted by JavaPF View Post
    Im not sure if you can run javac.exe like that. I think you need to open a command window (Start > Run > CMD) and navigate to:

    C:\Program Files\Java\jdk1.6.0_03\bin\

    using the 'cd' command to change directories then type javac.exe

    It should load up OK then...
    If you have setup the classpath correctly you can type javac instead of going to the java directory.

  9. #9
    Junior Member
    Join Date
    Jul 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: javac.exe problem

    how do i set it up so that i dont have to cd C:\(path) every time i open cmd to compile?

  10. #10
    Banned
    Join Date
    May 2008
    Posts
    25
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: javac.exe problem

    It should have been done automatically when you install java but if not you can set it in your enviroment variables setting like this:

  11. #11
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 286 Times in 225 Posts
    Blog Entries
    4

    Default Re: javac.exe problem

    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  12. #12
    Junior Member
    Join Date
    Jul 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: javac.exe problem

    Hmmm, not sure if Vista is different, i have opened the env vars, and there was no JAVA_HOME, so i've added a new one, called JAVA_HOME, and given it the classpath of C:\Program Files\Java\jdk1.6.0_07

    but when i open cmd still gotta use cd to use javac, not sure whether that was the purpose of changing the env vars though lol :-(

  13. #13
    Junior Member
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: javac.exe problem

    There are two things: first is specifying where your system would find javac.exe to execute; second is where your java compiler (or javac.exe) would find classes it needs to compile. Former would be specified in your systems PATH variable and latter would be specified by your CLASSPATH variable.

    To be able to execute javac.exe from anywhere, you must add following information to your system's PATH variable; i.e. you path variable would look like PATH=<path_to_java_installation_folder>/bin;<%other_PATH_variable values%>

    For more information on classpath, refer to following link:
    Welcome to J2EE Concepts - Java

    HTH,
    Anand
    Last edited by anandmohans; November 12th, 2008 at 01:13 AM. Reason: Putting a more readable URL

  14. #14
    Junior Member
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: javac.exe problem

    Hi,
    just had a go at this and had no joy. Can you explain why you've used the path D:\javaSoft\jdk...

    Thanks
    T