ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
On post #8, you stated that your class is called "HelloWorldApp" right?. In that case, your .java file has to be named HelloWorldApp.java (case-sensitive). If your file is called myfirstprog and your class is called HelloWorldApp, than that could be your problem.
Oops... just read some replies back and it looks like your program is called HelloWorldApp.java. Sorry... still, it is very very weird that the error points to "myfirstprog".
I think it will be really hard to spot your problem the way it is: Using two machines without configuring the path correctly and programs with different names for example. I would really recommend you to remove everything you have installed regarding Java from your machine and download a new version. Maybe the one you are trying to use got broken during download (happened to me once). If you are using the packages shipped with Slackware, you will probably be able to see them at /var/log/packages. Remove them...
Once you download a new version of java, configure the path correctly and make sure that you only have one JRE and SDK installed. Remember that SDK also includes the JRE. When you've done that, stick with one machine only. Java can be tricky to install for the first time(in Linux that is...), but once you got that right it will be a blast to install again or in another machine.
Just my two cents
Last edited by Mega Man X; 12-13-2006 at 03:37 PM.
I think it will be really hard to spot your problem the way it is: Using two machines without configuring the path correctly and programs with different names for example. I would really recommend you to remove everything you have installed regarding Java from your machine and download a new version. Maybe the one you are trying to use got broken during download (happened to me once). If you are using the packages shipped with Slackware, you will probably be able to see them at /var/log/packages. Remove them...
Once you download a new version of java, configure the path correctly and make sure that you only have one JRE and SDK installed. Remember that SDK also includes the JRE. When you've done that, stick with one machine only. Java can be tricky to install for the first time(in Linux that is...), but once you got that right it will be a blast to install again or in another machine.
Just my two cents
What is funny is I had it working on the other machine when i added /home/prog/jdk1.6.0/bin to my path and tried java myfirstprog and it worked, but I ended up screwing up my path and lost all kinds of commands, after I fixed that then It would not work again. The path does work now because when I do javac it creates the class file.
Interesting... Well, in the machine without conflict, just make sure that your Java class has the same name as your .java file as I suggested
Whew, I got it. I deleted all the sample java files and the class, downloaded a new one and compiled it and it ran. Thanks for the help, now on to actually learning java, :LOL:
The book I have is Introduction to Java Programming, Comprehensive Version, 5E. The sixth edition is out. One thing I've noticed with this book is that it is relatively math-oriented. For example, while most books out there explains what objects are by comparing them to cars or eggs, the author explains Objects through triangles and other geometric figure with some calculations. This is either a good or bad thing depending on you .
- This third book is more like optional. I would not recommend it as the only book to purchase, because it does not go very deeply on any aspects of Java. I see this book more like a complement to the other books with more useful examples and very well written to help you memorize important things and common mistakes a programmer can make in java. It is of course, Head First Java:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.