• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Unable to compile a Java program

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to compile a Java program at the command prompt. I have modified my PATH variable to locate the javac.exe, but I still get the following error (see attachment). I have read the FAQ on this topic, but I am still having problems. Please help! :
2021-06-06_08h49_01.png
[Thumbnail for 2021-06-06_08h49_01.png]
 
Marshal
Posts: 72913
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

That PATH doeson't look right to me. There is no such folder as javapath; please show us the contents as javapath (not as a screenshot please). The PATH to Java® should start with the drive letter (usually C on a Windows® box) and should end with bin.

[addition] javapath\bin might be a correct PATH component, and as you correctly guessed, it should go before any other PATH components that might contain a Java® installation. The \bin for the Java® PATH should therefore precede the first ;
 
Michael Sosa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually there is a javac.exe in javapath. Further down the path variable, there is a 2nd path which looks like 'C:\Program Files\Java\jdk-15\bin' which also contains a javac.exe.
 
Campbell Ritchie
Marshal
Posts: 72913
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...but you aren't finding either of them. I presume you have closed the command line and reopened it; the new PATH won't work otherwise.
 
Campbell Ritchie
Marshal
Posts: 72913
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Party.java? Is that from Sierra and Bates' Head First Java? The Party class is incomplete and cannot be executed.
 
Michael Sosa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I exited the command window and re-entered it. The path variable is unchanged. And Yes, the Party.java program is from the book you mentioned, but that is irrelevant since I can't find the javac.exe to tell me the error itself.  
 
Rancher
Posts: 4307
38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is there a % before the javac?  Try entering just javac
 
Michael Sosa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That worked. The % was in the book. I just copied it as is. Thank you all so much for your help, I really appreciate it.
 
Campbell Ritchie
Marshal
Posts: 72913
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I never noticed that %
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic