• Post Reply Bookmark Topic Watch Topic
  • New Topic

java compiler problem  RSS feed

 
Nick Stevens
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've written a Reversi game that runs ok and I'm working on improving the gameplay. The game consists of a main file called 'Reversi.java' and to compile I type 'javac Reversi.java' (using Mandrake Linux). In this file there are calls to methods that are in several separate files and I've recently noticed that the compiler seems to be ignoring changes to these files. If I create an error in the Reversi.java file, the compiler spots it immediately, but if I do the same with the other files it appears to compile anyway - I've even tried renaming some of the files so it couldn't find them but no error messages were displayed when I compiled it. Any suggestions would be much appreciated!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37465
539
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick,
Welcome to JavaRanch!

The compiler only recompiles the files you explicitly tell it to (in this case Reversi.java.) So if you change another file, it doesn't get recompiled. Javac just uses the already existing .class file. If all of your files are in one directory, you can use:
javac *.java

This will compile all the files each time.
 
Nick Stevens
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne,

Thanks for your speedy reply. The files are all in the same directory and javac *.java works fine. It makes sense now :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!