• Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue when running a java file from a linux cmd  RSS feed

 
Tiberius Marius
Ranch Hand
Posts: 115
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I m running the this from a Linux command line , in the cmd first i use :

javac -classpath acm.jar Chap6_ex1.java

end then :

java -cp .:acm.jar Chap6_ex1


The output i m getting after second command is :

Exception in thread "main" acm.util.ErrorException: Cannot determine the main class.
at acm.program.Program.main(Program.java:1358)

I know the problem is from the RandomGenerator class in packet acm.util.* but i dont know how to fix the problem . Every other program has worked .Can anyone explain me please what i m missing or how this whole issue of packet importing works when running a java file from cmd ?
 
Tiberius Marius
Ranch Hand
Posts: 115
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked in the location i run the commands and the arhive acm.jar has the acm.util section. Also if i run other programs i have saved they work with no issue .The RandomGenerator in acm.jar requires Random from java.util.

Found the issue , i forgot to put public at the start of the class declaration !
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!