Reputation: 23
Due to a suggestion I have decided to add the whole project to github, so it's easier for experts to help me :/. I've been googling around for hours and can't seem to fix it. https://github.com/NicholasExxonite/test_lab_week13
Alright. So this is from a lab class, we where given an archive with 2 .java files, one is Ball and another Triangle(they contain the class and methods to create the shapes) and 5 .class files called GameArena(the purpose of being it only a .class file and not the whole source code is so that we cannot change it). I need to create a main class and create instances of these classes and call their methods to create a working game. The triangle and ball .java files are okay, I can access them and call them. However my intellij just doesn't want to recognise GameArena.class. The contents of the given archive : https://i.sstatic.net/4umHY.jpg
I am a new java/intelliJ user running the 2018.2.7(build 182.5107.41)version with SDK 11.0.2. I decompressed the archive in my project's source folder, from then Ball and Triangle were usable, but GameArena not. So I tried adding it's path from Files-Project Structure-Modules, then I tried to add it to classpath in the platform setting. None of them work, when I try to build and run the main method I get the following error:
Error:(4, 9) java: cannot find symbol
symbol: class GameArena
location: class testGame
Error:(4, 33) java: cannot find symbol
symbol: class GameArena
location: class testGame
Screenshot: https://i.sstatic.net/j6W5F.jpg
public class testGame {
public static void main (String Args[]){
Ball newBall = new Ball(100, 100, 50, "Yellow");
GameArena newGame = new GameArena(200, 200);
}
}
Upvotes: 2
Views: 165
Reputation: 1167
You should do the following:
1. Copy your Gamearena Class files to a new Directory
2. Add your Libs directory as dependency to your module
3. Build your Project and start it
Let me know if it helps.
Upvotes: 1