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 7 of 7

Thread: JAVAC

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    12
    My Mood
    Confused
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default JAVAC

    Hi all - I am new to Java and I have just been playing around with my first program... I got Javac to work - but when I ask it to run the .java file it thinks about it for a couple of seconds and then returns nothing! Any ideas?

    My Prog:

    public class MyProgram {
    public static void main(String[] args) {
    System.out.println("Rome wasn't burned in a day!");
    }
    }

    Pic of CMD:

    untitled.JPG


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: JAVAC

    You're running the compiler, which creates a .class file. You have to run the .class file.

    Recommended reading: "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following User Says Thank You to KevinWorkman For This Useful Post:

    iansmiler (November 27th, 2012)

  4. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: JAVAC

    Returning nothing is good. That means it did not find any errors. If there were errors in the source file they would have been printed out.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #4
    Junior Member
    Join Date
    May 2012
    Posts
    12
    My Mood
    Confused
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: JAVAC

    I tried running .class file:

    untitled.JPG

    Still no joy....

  6. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: JAVAC

    Please copy and paste here the full contents of the console window.

    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: JAVAC

    Quote Originally Posted by iansmiler View Post
    I tried running .class file:

    untitled.JPG

    Still no joy....
    You aren't doing what the link I posted for you tells you to do.

    The compiler and the JRE are two different things. One compiles .java files into .class files, the other runs .class files. The link I gave you explains how to use both.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. The Following User Says Thank You to KevinWorkman For This Useful Post:

    iansmiler (November 27th, 2012)

  9. #7
    Junior Member
    Join Date
    May 2012
    Posts
    12
    My Mood
    Confused
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: JAVAC

    I'm on it! Thank you

Similar Threads

  1. Replies: 4
    Last Post: August 17th, 2012, 10:37 PM
  2. Do I have to keep setting the path file for javac?
    By fallout87 in forum Java Theory & Questions
    Replies: 1
    Last Post: November 24th, 2011, 07:33 PM
  3. javac help
    By mjpam in forum Java Theory & Questions
    Replies: 7
    Last Post: February 16th, 2011, 10:46 AM
  4. [SOLVED] can't run javac directly from command prompt
    By epezhman in forum Java IDEs
    Replies: 7
    Last Post: January 12th, 2011, 07:38 PM
  5. Problem of executing java.exe. How to code from absolute scratch?
    By sepalm in forum Java Theory & Questions
    Replies: 13
    Last Post: November 12th, 2008, 07:48 AM