• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems With This Code  RSS feed

 
Brian Bykenhaal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble compiling this code I do not seems like I got some errors.




 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What hint does the compiler give you? I hope that line number 75 is commented out properly.
 
Brian Bykenhaal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a run down of all my problems thing is I can't seem to change the code correctly. This class was for when I was running my test on my board I need it in order to run my project. Thing is I do not need anything but the TicTacToe enabled. As you might know I have other classes and I am want to have it work with the other classes. So I need help with my int,int,ActionListener as you can see. Seems that I may of set up may code the wrong way not knowing it would have trouble compiling "Big Mistake"

So here you can see I use a this to make a new board but I am getting errors when compiling. My actual and formal argument lists differ in length and I need to fix that so I can compile.
Board TicTacToe = new Board(rows,cols);





 
Campbell Ritchie
Marshal
Posts: 56595
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which package is the Board class in? Has it been compiled successfully?
 
Brian Bykenhaal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I got some issues still with my main and my cell classes. I rewrote the code and I think I fixed that errors. Now I have the following errors. My code Runs with the IDE but will not compile so I have to fix the following issues.

error: class TictacToeGUIGame is public, should be declared in a file named TictacToeGUIGame.java
public class TictacToeGUIGame extends JFrame {
1 error
The following error occurred while executing this line:
Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read and try to understand what the error messages mean. This tells you quite clearly what's wrong:

error: class TictacToeGUIGame is public, should be declared in a file named TictacToeGUIGame.java

What do you think the compiler is telling you here, and how do you think you could solve the problem?
 
Brian Bykenhaal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tried to create a jar and got this error.
jar cfm TicTacToeGUIGame.jar Manifest.mf Board.class Cell.class Mark.class Outcome.class Player.class TicTacToeGU
IGame.class
java.io.IOException: invalid manifest format
at java.util.jar.Manifest.read(Manifest.java:225)
at java.util.jar.Manifest.<init>(Manifest.java:69)
at sun.tools.jar.Main.run(Main.java:172)
at sun.tools.jar.Main.main(Main.java:1177)

MY main class looks like this

Main-Class: TicTacToeGUIGame


two return spaces after the main class
 
Brian Bykenhaal
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well thanks for the tip I dropped the public do I need .java after to make it the same as my class name? That is right I can only have one public class in a Java file. I added thje .java for that class name and got more errors then I wanted so I dropped the public. I still have a yellow mark but no red now by that line of code.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!