0

Based on java documentation, I've set up my project as such: Source files are in C:\...\sources\com\myname\tictactoe\ And my class files are in C:\...\classes\com\myname\tictactoe\ When I try to run a class (Main.java) in that directory (on powershell) by running "java Main", I get "Error: Could not find or load main class Main Caused by: java.lang.ClassNotFoundException: Main". All my files start with "package com.myname.tictactoe;", and from what I understand that's how they're supposed to be. What am I doing wrong?

2 Answers2

2

Your java class has a package name so you will not be able to run just java Main. You will need to run java com.myname.tictactoe.Main.

M. Rizzo
  • 1,611
  • 12
  • 24
0

Change directory to C:\...\classes then run

java -cp . com/myname/tictactoe/Main
Eskandar Abedini
  • 2,090
  • 2
  • 13