• Post Reply Bookmark Topic Watch Topic
  • New Topic

could not find or load main class Test reached end of file while parsing errors  RSS feed

 
Manuel Ruiz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I am trying to compile/run this simple program:


I am getting error: could not find or load main class Test when using Notepad++

I have set path and classpath and still the same.

If I try it from CMD I get : reached end of file while parsing...

Any advise/help will be greatly appreciated.

Thanks

PS If I run it from Netbeans it works fine.

 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the command you're using to compile and run the program.
 
Manuel Ruiz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stephan

When using Notepad++ I press F6 and type :

cd "C:\Users\Manuel\Desktop"
javac Test.java
java Test

When using CMD:

c:\program files\java\jdk1.8.0_121\bin then I type

javac Test.java


 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what is the output of "javac Test.java"?
 
Manuel Ruiz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from CMD = ...reached end of file while parsing errors

from Notepadd++ = Create Process() failed with error code 2:
                             The system cannot find the file specified .
 
Manuel Ruiz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was able to run it from CMD....
 
Dana Ucaed
Ranch Hand
Posts: 406
6
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What operating system did you use?

I have one similar problem and I added . in my classpath.
 
Dana Ucaed
Ranch Hand
Posts: 406
6
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try
javac -version and java -version.
 
Campbell Ritchie
Marshal
Posts: 56595
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dana Ucaed wrote:You can try
javac -version and java -version.
If you are getting error messages like that, you probably have at least javac correctly installed and added to your PATH, so those instructions are unlikely to add anything new.
If you are adding . to your CLASSSPATH, you have probably made a mistake by creating a system CLASSPATH at all. I know this is a digression, but please post what you see when you execute
echo %CLASSPATH%
at the command line.
 
Knute Snortum
Sheriff
Posts: 4288
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is F6 in your Notepad++ program?
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class containing your main() method is supposed to be public. Your class isn't, so it's possible that's the source of the problem. Or it might not be... anyway I'd suggest you declare the class public and see if that helps.
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, classes don't have to be public for the main() method to be found.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!