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.
i'm pretty sure i'm wrong but java MIGHT be cos youv'e used print not println. i know C doesn't print the lin until you insert a newline, but other than that i can't suggest anything. I would've tried it, but i've not got java installed at the moment...
ahh bobbins... yes i have.. no the code works fine at least, no problems there... tired... time for bed...
maybe the standard out isn't set up ...? try redirecting the output to a file.
I should be able to use print, well I can at uni. Will do what you suggested when I get back home. I need some sort of tutorial on setting up Java in Linux. Do you know of anywhere?
Problem solved. You were right about println, print didn't come up wiv anything, but println did. Also, print worked for tty1, but not how I had imagined it to.
The print() method on it's own does not print to the screen unless the System.out.flush() method is invoked afterwards. The println() method effectively does it for you, so this would also work:
The print works, but the bash prompt ends up right after it and after pressing any key the text disappears and the prompt takes its place!
Also, I want to use another class in my program, and was told to stick in the same directory to be able to access it. Is this correct as the compile doesn't work, saying it can't find the class.
Maybe a "\n" (newline) at the end of the print would clear the first problem up. As far as accessing another class, as with everything, Java is case sensitive, so make sure that you have specified the name exactly right. If you start compiling your first class, it should check the dependencies and compile the class it is including. To be sure you could compile the second class first, sort out any errors, and then compile your first class.
If your program splits into loads of classes though, you can trust the dependency checker to sort everything out
(the java compiler is ALWAYS right )
now forgive me if i take u guys back ,but i am new to linux and its been pretty difficult coming to terms with it.now my problem is simlpe even if it sounds dull ,i am desperate to get java running on my redhat linux system .it was installed by someone else and i dont know where it is but it is installed .so how do i run it . the only text editor i have is emacs ,how do i use it to key in my programs or could i use pico.thirdly i downloaded an online version of thinking in java ,how do i unzip it.i am desperate and will really appreciate step by step elementary answers .please i await your accelerated response .i have read a lot of your posts and you guys have been magnificent, please help get me started.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.