0

Using the ls commmand, I can clearly see both the .java file and the .class file of my main class created from compilation. However, when I try to run it, the Ubuntu terminal says that the class was not found. Here's a screenshot of my terminal

enter image description here

And here's a snippet of my main class enter image description here

Any answers?

John Smith
  • 107
  • 1
  • 13

2 Answers2

0

You haved a class inside package. So you should run your class in /home/se folder and use command java cs3421_emul.cs3421_emul

Sujay Mohan
  • 933
  • 7
  • 14
0

Since your classes are in a package your compiled classes should in the proper folder structure.

To compile the classes to proper package folders use -d . switch while compiling.

javac -d . *.java

The above command will create folders based on the package of the classes. for example you class3421_emul has a package class3421_emul so it will be compiled to class3421_emul folder.

Then run the class using java class3421_emul.class3421_emul

seenukarthi
  • 8,241
  • 10
  • 47
  • 68