Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do I disable compiler warnings--not errors?

 
Brian LaRue
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what I've done, but when compiling into bytecode, the compiler will sometimes give me a warning message after compilation. Is there a way to disable these types of messages? The most common type of "Warning" message is that my local variable is never read. I know that this is potentially a problem, but I'm in the middle of development and code which will later use those local variables is soon to come. It's just more of an annoyance then helpful advice. Here's an example:


Is there a switch or something to ignore warnings and only stop on errors? Or did I foul something up during installation? I'm not using an IDE, I'm typing up .java files in a text editor and compiling from a terminal.

Thanks,

Brian
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Brian LaRue:
...I'm not using an IDE, I'm typing up .java files in a text editor and compiling from a terminal...

But is "javac" actually Sun's compiler? These look like Eclipse messages.

What OS and Java version are you running?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javac -nowarn Main.java
 
Brian LaRue
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I should have known. I did install Eclipse to try it out but have since uninstalled it. I'll bet it's still lingering around and taking over my 'javac' by Sun.

I'm using Ubuntu (Feisty) and


anyone know how to fix this one? how does someone switch back to the Sun version of 'javac'? Does Eclipse modify your CLASSPATH to point to it's own compiler?
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just remove the entry in the PATH that pointed to that version of javac.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic