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: Problem with Compiling on mac

  1. #1
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Problem with Compiling on mac

    Hey there!

    I've been working on a program in textedit and compiling it in the terminal. It's been a while since I've compiled anything, and when I did, and tried to run the program, I get "Campsite.java: command not found", and this is AFTER I've successfully compiled the program. Any way to solve this issue?


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Problem with Compiling on mac

    What command did you use? It seems like you're forgetting to invoke the java compiler itself:

    javac Capsite.java

  3. #3
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Compiling on mac

    Nope, I did that and it compiled successfully. Then when I try to run it, it comes out with the message I provided.

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,372
    Thanks
    183
    Thanked 836 Times in 779 Posts
    Blog Entries
    5

    Default Re: Problem with Compiling on mac

    How are you trying to run the program? Are you passing the class name to java (something like "java Campsite")?

  5. #5
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Compiling on mac

    I am using Campsite.java to run the program, and that has always worked for me up until now.

  6. #6
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Problem with Compiling on mac

    You don't run the .java source file, you run the outputted .class file. In any case, you shouldn't be specifying the extension.

  7. The Following User Says Thank You to helloworld922 For This Useful Post:

    Scorks (September 5th, 2013)

  8. #7
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Compiling on mac

    Hahaha, now I feel like an idiot. Thanks a lot! It's been like 4 months since I've had to do this (summer break, full time work). I seem to be a bit rusty! Thanks a million.

Similar Threads

  1. Replies: 5
    Last Post: January 23rd, 2013, 05:29 PM
  2. problem with compiling
    By silverpen10 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 21st, 2013, 02:08 PM
  3. Java compiling windows 7 problem
    By wiseone in forum The Cafe
    Replies: 3
    Last Post: July 26th, 2011, 04:06 AM
  4. Replies: 1
    Last Post: July 25th, 2011, 01:33 PM
  5. Eclipse on Mac
    By Cuju in forum Java IDEs
    Replies: 6
    Last Post: March 19th, 2010, 10:29 PM

Tags for this Thread