SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:Welcome to the Ranch!
You shouldn't need to register it manually. If you installed the JRE (either a standalone or one that comes with the JDK) correctly that should have been done for you.
Just try to run your Java commands. If that fails due to a problem with jvm.dll I suggest you reinstall your JRE / JDK.
Campbell Ritchie wrote:Where are you registering it? Is that registering as a user with Oracle? As Rob has told you, there is no need to register anything anywhere. As I told you, all you need to do is set the PATH and you must have done that to get anything to compile.
Please explain what you are doing, because I suspect you are trying something unnecessary.
Campbell Ritchie wrote:You don't usually "open" .class files, you try to run them. You need to run whichever class has the main method in, and that should use all the other classes, directly or indirectly.
You would write
javac Party.java
... which you obviously have already done. Note the absence of any "finished" messages, which you take as meaning success. If there are any errors found, there will be lots of messages.
Then to execute Party you write
java Party
... omitting any extensions, a feature which catches many beginners out. Then you get an error because (as I hinted earlier) the Party class as given lacks a main method, so it cannot be executed directly. It will probably work better if you substitute MooseGreetings for Party throughout
Please give us a link to whatever you found on Google; you have either misunderstood it or the link provides at best confusing information.
. . . or similar. Follow it withmkdir java
. . . and use the same command next time you open the command line.cd java
. . . to execute the file.javac MooseGreetings.java
java MooseGreetings
Campbell Ritchie wrote:Advice I give regularly: when you open your command prompt, enter this command, once only
. . . or similar. Follow it withmkdir java
. . . and use the same command next time you open the command line.cd java
You now have a "java" folder in "My Documents" and you want to save your .java files there. Don't use NotePad, but look here for alternatives. Then you can use. . . to execute the file.javac MooseGreetings.java
java MooseGreetings
Campbell Ritchie wrote:Yes, of course you can get a Mooo popup or animation. But that is a long way beyond the level of using a MooseGreetings class; you have lots to learn before you can achieve that. MooseGreetings is simply a different version of a Hello World class.
Don't call me Camp.
Well done getting it working. Please tell us what the errors on the desktop are.
I can't see anything about .dll files on our "how to run your first ..." FAQ page which you quoted earlier.
Campbell Ritchie wrote:Please give us the link you found, so we can decide whether it is any good or not.
Please tell us the errors you are getting on your desktop. We have probably seen them before ourselves.