Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion with Javac Compiler

 
Jonathan Pro
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I finally started reading into programming today and came across a roadblock.
How do I add an entry to PATH environment variable that points to the bin in java directory?
I'm a beginner reading Head First Java.
I forgot to mention I'm using Notepad.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the environment you are using (Windows,Linux/Unix etc..). Here is the place contains all the details a beginner may need.

And Welcome to JavaRanch as well to the World of Java
 
Jonathan Pro
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick reply and welcome.
That Beginner FAQ helped a lot, I guess I should've searched around before making a new thread so quickly.
I have errors on it though, it says "Could not find main class"
Here's my code:

 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to mention I'm using Notepad


It's good to use a editor other than an IDE in the first place but notepad is a very basic editor. There are good editors availble on the web though.

I have errors on it though, it says "Could not find main class"


Did you able to compile it succesfully? Is the error comes when you run it? If Can you post the full stack trace?

 
Jonathan Pro
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I couldn't compile it to a class and how do I post the full stack trace?
I'm prolly annoying you right now. lawl
When I tried to compile it said:
error: Class names, 'DooBee.app', are only accepted if annotation processing is explicitly requested. 1 error.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jonathan Pro wrote:When I tried to compile it said:error: Class names, 'DooBee.app', are only accepted if annotation processing is explicitly requested. 1 error.


How you named your java source file ?What is DooBee.app? Seems you have put the source file in a package and use wrong name ? What is the command you use to compile ? (I assume you have set the PATH properly and working from command line ?)


 
Jonathan Pro
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made a typo, it was DooBee.java.
I don't know how to set the path.
I'm using Vista and I found the path variable thing but would this be the path I input?
C:\Program Files\Java\jdk1.6.0_11\bin
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should take a look at this (specific link from my previous post). Just follow that tutorial and you will be ready to go .
 
Jonathan Pro
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did follow it but it's not working. :/
My Java directory is also in my Program Files and not root C.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the error you are getting now? Try "echo %path%" in command prompt to see what's in your path variable and post it here. If you don't have it pointing to the bin directory of your JDK installation you have to add that to the path variable (through environment variables in Advanced System Properties - for Windows).
 
Campbell Ritchie
Sheriff
Pie
Posts: 48981
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java™ Tutorials. There are sections about installing Java, and you find a link to setting the PATH in the "common problems" page.
Somebody said not to use NotePad: agree. Try NotePad2, NotePad++ or jEdit, but jEdit requires Java to be working.
Create a "java" folder to contain your work somewhere. Try opening a command prompt, thenand you are in your java folder, which you have probably created in "My Documents".
If you start getting errors like "annotation processing enabled" that suggests you have in fact installed Java correctly and have set your PATH correctly already. The error caused by not setting the PATH usually reads "javac is not recognized as a . . ."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic