• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Having Trouble Compiling

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I installed the Java software onto my computer, along with the NetBeans IDE. I then tried to set the environment variable correctly (though still haveing problems with that). Now when I use the Command Prompt to compile the program I still get an error message. Any suggestions?
 
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Leave NetBeans alone until you are used to using the command line. IDES hide the use of command-line arguments, and also there is enough to learn with Java alone, without having to learn the IDE too.
Learn the IDE later.

What are you trying to compile and what sort of error are you getting?
Have you found the Java Tutorials? There is a page about "common problems."
Please tell us what the error messages say; we usually recognise them, but can't help without that information.
 
Benjamin Chau
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Campbell,

I'm not concerned about the IDE but would definitely like to the program to compile and run with Command Prompt at least. Here's the message I get when I run Javac on a program:

'Javac' is not recognized as an internal or external command, operable program or batch file.
 
Campbell Ritchie
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That tells me two things:
  • 1: You are using Windows; Linux gives a different error message.
  • 2: You haven't got your PATH set up correctly.
  • Everybody gets that problem. That is why it is the first problem quoted in the "problems" link I sent you. Follow the instructions in that, and follow the link to "setting the PATH permanently." Make sure to set it permanently, and don't believe them when they say it's "optional."
    It will be a lot easier if you remember where you installed Java; that will be the same directory as you told NetBeans when it asked about JAVA_HOME or similar. The PATH entry starts with the drive letter (usually C) and ends with bin.

    You don't need lots in your CLASSPATH, but you might as well check it when you set the PATH. It should have .; or ;. or ;.; in it somewhere, where the . means "current directory." You usually have to change your PATH and don't usually have to change your CLASSPATH.
    [edit]Add this link which tells you about setting the PATH.[/edit]
    [ November 05, 2008: Message edited by: Campbell Ritchie ]
     
    Campbell Ritchie
    Marshal
    Posts: 79943
    396
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    By the way, it's not Javac but javac. I did try Javac on my Windows box and didn't get an error, so I don't think it is the capital J causing the problems.
     
    Sheriff
    Posts: 22815
    132
    Eclipse IDE Spring Chrome Java Windows
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Windows is case insensitive so you can even call it jAVaC if you like
    The file also doesn't have to match the actual case.

    Now when running the application, the class name's case DOES matter. But then again, only the class name; you can write JaVa if you like.

    Note that Linux / Unix is 100% case sensitive.
     
    Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
    Gift giving made easy with the permaculture playing cards
    https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    reply
      Bookmark Topic Watch Topic
    • New Topic