Programming your first java program, hello world

go here and do it quick and fun;
http://www.geocities.com/jon_riley/jon/java.htm

It is not visual, the same may we learned programming in class.I disagree. The tutorial may not have as big pictures as you have but it sure is visual:
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html
Besides getting the thing done, it explains the common errors you could get, and applies to winNT and 2k (ME, anyone?) as well as win9x. Can you give any reason I should from now on recommend people using 32bit windoze to go to your page rather than the tutorial page?
By the way, who learned programming in class?

Similar Messages

  • One more time, programming your first java program

    go here;
    http://jonjon.0catch.com
    mirror site;
    http://geocities.com/jon_riley/jon/java.htm

    I must assume that your continued use of the forum as a signpost to your home page represents your lack of understanding of the "Terms of Use" agreement that you had to accept to be a member of the forum.
    4.5 You agree not to use the Services for any unlawful activities not otherwise covered above, including (without limitation) attempting to compromise the security of any networked account or site, operating an illegal lottery or gambling operation, stalking, or making direct threats of physical harm. Additionally, You agree not to use the Services to:
    (h) use Your My Sun account as storage for remote loading or as a door or signpost to another home page, whether inside or beyond Sun.com.
    Other sections also apply.

  • Your first Java job?

    Anyone care to describe their first job where the were able to use and apply Java technology? Did you come from a prior programming background? How did you like it?
    I'm trying to gather some info so I have some idea what the Java market is like out there.

    Well, back in 95/96 I was working (as a C++ guy) on the third generation of an Object Oriented 4GL for a well known database company...
    Neat product. Crappy widget set and released the same days as Borland Delphi - but apart from that it had everything going for it ;)
    Then, some jokers from just around the corner (we were based in Palo Alto in those days) came up with this new-fangled Java nonsense and we said sh***************t! The game was, most definitely, up.
    Unphased, we bungled on and got hold of the JDK. Played around a bit and decided that we could modify our product to generate Java instead of C with SQL embedded in it. So we did. I think we sold it to oh, must be at least two companies, but I heard one of them paid for it by mistake ;)
    As luck would have it, the internet was about to boom so I got a contract with Cisco and spent three years designing and developing a network provisioning system - in Java, of course.
    Been at it ever since. Mostly for Investment banks, though I still do some networking stuff.
    However, to answer your question about the Java market; from a contractors perspective, it's hosed. But then the whole IT market is.
    I'm currently doing two contracts at the same time and still (just) manage to earn less than I did 18 months ago working on one. Go figure.

  • Getting ConnectException in linux with Hello World socket program

    Hello
    i'm running a hello world application that uses sockets ( [found here|http://blog.taragana.com/index.php/archive/understanding-java-simplified-hello-world-for-socket-programming/] ) . I'm running it using a windows machine and a linux machine. When the windows machine is the server, and linux the client, no problem, the application works fine. But when the server is linux and the client is in windows i got a
    java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:352)
    in the linux machine i've checked the port being used and it seems to be listening
    logan@logan-desktop:~$ netstat --listening |grep 6500
    tcp6 0 0 [::]:6500 [::]:* LISTEN
    i've also tried changing the port and i got the same error
    and i have to say that there is no firewall installed in the linux machine and in the windows machine i disabled the firewall but i'm still getting the same error
    what else should i check? or any clue about what could be happening?
    thank you in advance
    any help would be appreciated

    puki_el_pagano wrote:
    i'm running a hello world application that uses sockets ( [found here|http://blog.taragana.com/index.php/archive/understanding-java-simplified-hello-world-for-socket-programming/] ) . I'm running it using a windows machine and a linux machine. When the windows machine is the server, and linux the client, no problem, the application works fine. But when the server is linux and the client is in windows i got a
    java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:352)
    in the linux machine i've checked the port being used and it seems to be listening
    logan@logan-desktop:~$ netstat --listening |grep 6500
    tcp6 0 0 [::]:6500 [::]:* LISTEN
    i've also tried changing the port and i got the same error
    and i have to say that there is no firewall installed in the linux machine Are you absolutely sure?
    what else should i check? On the windows box
    open a cmd window
    C:> telnet linuxbox 6500

  • Hello world puzzle

    I new to java and I was asked the following Q -
    Here is a simple hello world program -
    public class A {
    public static void main(String a[]) {
    System.out.println("hello world");
    Now question is can I print something like "hello java" before "hello world"
    without modifying Class A ?
    My soln -
    Class B {
    public static void main(String a[]) {
    System.out.println("hello java");
    A.main(null);
    Is there any other elegant solution to the above problem ?

    Now question is can I print something like "hello java" before "hello world"
    without modifying Class A ?
    amuamu wrote:this may be one solution
    public class BeforeMainEx {
         static {
              System.out.println("hello java");
         public static void main(String[] args) {
              System.out.println("hello world");
    Rulz is Rulz Macca... Now drop an gimme 20 ;-)
    But yes... a static initializer placed anywhere would print before main is invoked.
    Edited by: corlettk on 13/03/2009 22:55 ~~ Ooops!

  • My first Java - failed ....

    Hi, this is a simple question:
    Right now I try to build my 1st Java-program ("Hello world"). I follow the tutorial
    http://www.oracle.com/technology/obe/obe9051jdev/firststep/firststep.htm#t2s2
    The make was successfull, but run failed with the message
    :\DevSuiteHome_1\jdk\bin\javaw.exe -ojvm -classpath D:\DevSuiteHome_1\jdev\mywork\MeineErsteApp\MeinErstes_Projekt\classes mypackage2.Hello
    Fatal error: Cannot find class java/lang/StackOverflowError
    Process exited with exit code -1.
    And this is the program:
    package mypackage2;
    public class Hello
    * @param args
    public static void main(String[] args)
    System.out.println("Hello World");
    }

    It will continue to work. JDeveloper comes in a zip file and has no specific installer. You should unzip it in its own home directory and everything will continue is before.
    I have five different versions installed without problems.
    --olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Just finished my first Java application. What's next?

    Thanks to the kind help from everyone on this forum and some intensive labor for the last couple of months, I've finally given birth to my first Java application. I used Netbeans as my IDE of choice. During the development stages I would run my project directly from the IDE. In the project folder, a total of five folders were created: build, dist, nbproject, src, and test as well as two files build.xml and manifest.mf.
    Being a newbie in this field, I was wondering about the remaining steps needed to distribute the application. Here are some questions that come to mind:
    1) I know I can simply just double-click the project's *.jar* file to get it work. Is that the norm with Java applications or do I need to create a different file? I'm used to seeing *.exe* files. I'm also used to seeing an installation process, which brings me to my next question.
    2) Do you simply just zip the entire project folder and allow people to download it on their computer hoping they know how to access the *.jar* file?
    3) Seeing that I've only been testing the application in Netbeans, will there be file path or classpath problems if I run it on other computers? Are there necessary steps I need to follow to avoid such problems?
    4) Do you take any precautionary steps to protect your code? Do you lock the folders?
    5) In the future, if I decide to add a small fee to download the application, how hard would it be to add a password activation feature? (I know this could get pretty complex)
    Thanks in advance for all your suggestions.

    mohogany wrote:
    Thanks to the kind help from everyone on this forum and some intensive labor for the last couple of months, I've finally given birth to my first Java application. I used Netbeans as my IDE of choice. During the development stages I would run my project directly from the IDE. In the project folder, a total of five folders were created: build, dist, nbproject, src, and test as well as two files build.xml and manifest.mf.
    Being a newbie in this field, I was wondering about the remaining steps needed to distribute the application. Here are some questions that come to mind:
    1) I know I can simply just double-click the project's *.jar* file to get it work. Is that the norm with Java applications or do I need to create a different file? I'm used to seeing *.exe* files. I'm also used to seeing an installation process, which brings me to my next question.It's quite common to provide a shell script (batch file, etc) to launch the app.
    2) Do you simply just zip the entire project folder and allow people to download it on their computer hoping they know how to access the *.jar* file?You can do. There are also installation utilities around. InstallAnywhere is the only one I've ever used, but others do exist.
    3) Seeing that I've only been testing the application in Netbeans, will there be file path or classpath problems if I run it on other computers? Are there necessary steps I need to follow to avoid such problems?Probably. The best way to avoid them is to test them, and to not ever depend on the CLASSPATH environment variable. That's a portability nightmare.
    4) Do you take any precautionary steps to protect your code? Do you lock the folders? Nope.
    5) In the future, if I decide to add a small fee to download the application, how hard would it be to add a password activation feature? (I know this could get pretty complex) Don't bother. Unless you've got something amazing, in which case you'll be needing lawyers, it's not worth the trouble of charging for it. No offence, but your first Java app is hardly going to set the world on fire anyway.
    No matter what you try and do to stop people stealing your code, they'll manage it. Or, alternatively, just steal your idea instead.

  • Hello world tutorial

    is there any simple tutorials for starting j2 me like the classic helloworld.
    ones that explain the code that is. ive looked at 2 for getting started on this site but they dont really explain the code, more about getting the examples build and running.

    package greeting;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class HelloWorld extends MIDlet implements CommandListener
    private Display display ;
    private TextBox textBox ;
    private Command quitCommand;
    public void startApp()
    display = Display.getDisplay(this);
    quitCommand = new Command("Quit", Command.SCREEN, 1);
    textBox = new TextBox("Hello World", "My first MIDlet", 40, 0);
    textBox .addCommand(quitCommand);
    textBox .setCommandListener(this);
    display .setCurrent(textBox );
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    public void commandAction(Command choice, Displayable displayable)
    if (choice == quitCommand)
    destroyApp(false);
    notifyDestroyed();
    Compiling Hello World
    javac -d d:\j2me\tmp_classes -target 1.1 -bootclasspath
    d:\j2me\midp1.0.3fcs\classes HelloWorld.java
    Running Hello World
    midp -classpath d:\j2me\classes greeting.HelloWorld
    I have a very good documentation about this, if you want them.... just let me know.

  • How to compile a simple "Hello World" program in Java by using Netbeans

    Hi all, I am very new to java programming arena. i am trying to learn the most demanding language for the time being. To program, i always use IDE's as it makes programming experience much easier by underline the syntax errors or sometimes showing codehint. However, I am facing some problem when i use Netbeabs to compile a simple "Hello world" program. my problem is whenever i write the code and press compile button, netbeans says "main class not found". Consequently,i am becoming frustated. So, i am here in this forum to get some kind help on How i can compile java programs in Netbeans. Please help me out, otherwise i may lose my enthusiasm in Java. please help me, i m stuck

    Go to http://www.netbeans.org/
    You should find tutorials there.

  • Hello World Program

    hello, i'm making a program, that is suppose to take as an arugument the name of a paerson, and greet that person. For example;
    class Hello
    { static void main( String[] args)
    System.out.println("Hello, World!");
    Using this program to modify, one would be able to type this in the command line and get the output underneath:
    %java Hello tara
    Hello tara!
    %java Hello there
    Hello there!
    please any help as to what to do would be helpful

    Hi,
    is this a homework? if it is i suggest you read a java book first and learn java.
    Anyways, for your sake... here is the explanation... args is an array of String that accepts parameters from command line. Since you want to get the first argument from the command line (the name) then you should get the first String object in the args array. Index 0 is the first String.
    Note: "args" is just a variable name... you can change it to whatever name you like as long as it doesnt cause conflict to the Java's Keyword
    I hope next time... you read java tutorials first. =)
    Good luck
    class Hello
    { static void main( String[] args)
    System.out.println("Hello, "+args[0]);

  • Simple "hello world" program

    I have the following code:
    public class hello
    public static void main(String[] args)
    System.out.println("Hello World");
    I get the following message when I try to run this program:
    Exception in thread "main" java.lang.NoClassDefFoundError: hello
    Does anyone know what could be the cause of this error?
    Thanks in Advance!!

    Please check your class path. Make sure that current working directory is included in it.
    If not add it as shown below
    set classpath=%classpath%;.;

  • Exception in Hello World Program in Hibernate

    Hi All
    I am trying to run my first "Hello World" hibernate program in the book "Java Persitance with Hibernate". I have written the model class and the main class.
    I have also create the mapping file Message.hbm.xml and hibernate configuration file hibernate.cfg.xml through hibernate tools. Now when I am running the main class i am getting the following exception.
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Exception in thread "main" java.lang.ExceptionInInitializerError
         at com.hibernate.test.HibernateUtil.<clinit>(HibernateUtil.java:17)
         at com.hibernate.test.HelloWorld.main(HelloWorld.java:15)
    Caused by: java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
         at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:223)
         at org.slf4j.LoggerFactory.bind(LoggerFactory.java:120)
         at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
         at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)
         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255)
         at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:165)
         at com.hibernate.test.HibernateUtil.<clinit>(HibernateUtil.java:15)
         ... 1 more
    Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         ... 9 moreI have added the following jars from the folder hibernate-distribution-3.5.2-Final\lib\required
    commons-collections-3.1.jar
    dom4j-1.6.1.jar
    javassist-3.9.0.GA.jar
    jta-1.1.jar
    slf4j-api-1.5.8.jar
    and hibernate3.jar to the classpath.
    It would be great if someone could help me in resolving this problem
    Thanks in advance
    Fierof2

    user13519911 wrote:
    I have posted this question here because this is a hibernate program with is related to database connectivity. What i would like to know is what is the jar file i am missing and why is it not present in the required folders of hibernate distribution.Yeah. With that kind of unproductive attitude I suddenly lose all interest in helping. So weird.
    Guess I'll do what I like: be blunt. You are allowed to think. I suggest you do so.

  • My first java program. Design improvements?

    Hello all,
    I'm new to this forum (just joined today) so hi! I've been learning java for the last few months by reading a few books, and finally decided to take a crack at my first program (beyond hello world). This one is windows only. At work with a co worker we found that in windows 2000 the background images could get out of sync, so this program gives the user an alternative way to set the backgrounds.
    What I'm asking is if anyone has any time to kill and enjoys reading source code to take a look at it for me. If you see any issues with how the program was implemented and could be improved please let me know.
    Here's the link to the src: http://will.willandnikki.com/projects/bgchanger/BGChanger_src.zip
    Here's a link to my jar:
    http://will.willandnikki.com/projects/bgchanger/BGChanger.jar
    Thanks,
    Will

    Right now, my opinion in java is that it's too
    complicated for no reason compared to C++..It's not too complicated, it's just that you are new at this.
    Here's a little example of a simple class with a simple main method, the rest figure it out yourself, and with time read some java books, you won't learn java just by knowing C++.
    public class Human {
        // See this as C constants (although they're not their Equivalent)
        public static boolean MALE = true;
        public static boolean FEMALE = false;
        //member variables.
        private String name;
        private boolean sex;
        /** Creates a new instance of Human */
        public Human(String n, boolean s) {
            name = n;
            sex = s;
        }//End of CONSTRUCTOR.
        public String getName() {
            return name;
        }//End of getName
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append("[Name: " + name);
            if(sex)
                sb.append(", sex: Male]");
            else
                sb.append(",sex: Female]");
            String returnValue = new String(sb);
            return returnValue;
        }//End of toString()
        //Just the main program, it could be at another class.
        public static void main(String[] args) {
            Human h = new Human("Pablo", Human.MALE);
            String theHumanAsAString = h.toString();
            System.out.println(theHumanAsAString);
        }//End of main method
    }//End of class

  • Xcode unabled to run any program (even Hello World default)

    I've started into programming c++ and java in Osx (come from linux) and i've tried xcode (after trying netbeans, eclipse etc) because i find it the most comfortable IDE to work.
    The problem comes when i download xcode on my own laptop, after the large download and installation (and few updates) i tried the basic Hello World program.
    What is my surprise when, after building succesfully, i get no output at all outputs sections, but more surprised when i try to stop running the program and xcode doesn't respond.
    I get this error with every program, doesnt matter which language.
    I also have a crash when quitting xcode (it freezes and colored ballon pointer appears), so i have to force xcode quit.
    Have anyone faced this issue before? or known whats the issue related with?
    I'll really appreciate any help (as i can't program anything in osx if i want to use xcode)

    From my Guest account it works perfectly.
    How can I make it works on my Account ? Which preference file should I need to change.
    Here is the message from the debugger
    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle </Users/USER/Library/Application Support/iPhone Simulator/7.1/Applications/A0D30F60-57F6-41C5-9EB0-E5FE46F50DB1/ToDoList.app> (loaded)'
    Thank you for your help

  • Trying to compile my first Java program !

    Hi,
    I am a new programmer.Looking to clarify a very simple doubt while compiling my first java program.
    I have set up jdk in the following directory on my PC , E:\j2sdk1.4.1_01\bin.
    Now when I create the first AClass.java file in the AClass directory under bin and try and compile it I get the following error.
    E:\j2sdk1.4.1_01\bin>java E:\j2sdk1.4.1_01\bin\AClass\AClass
    Exception in thread main
    java.lang.NoClassDefFoundError: E:\j2sdk1/4/1_01\bin\AClass\AClass
    Kindly help me how to fix this.

    hi,
    Just do this,
    set path & classpath either in the system environment veriable or in the command prompt as shown below.
    set PATH=%PATH%;E:\j2sdk1.4.1_01\bin
    set CLASSPATH=%CLASSPATH%;.
    Be careful, there is a trailing DOT (.) at the end of the classpath, and that is what needed for
    the JVM to find the class file. with this you would be able to run your program. Infact JDK1.4.x and higher
    doesn't requires classpath to be set, your system classpath variable needs a DOT (.)
    at the end of the classpath variable defined in the environment variable section of your computer or
    in the command prompt you need it to set it once for the current command prompt window before
    executing any java program.
    Regards
    Goodieguy

Maybe you are looking for

  • How to print JTextPane containing JTextFields, JLabels and JButtons?

    Hi! I want to print a JTextPane that contains components like JTextFields, JLabels and JButtons but I do not know how to do this. I use the print-method that is available for JTextComponent since Java 1.6. My problem is that the text of JTextPane is

  • Can a thread do more than one thing at once?

    Hey all, I'm confused a little bit on how a thread might act in this situation: I have a server-client setup. The thread on the Client sits and waits to receive instructions from the server. When it does, it manipulates some ArrayLists I have in the

  • Photosmart 7510 web services and efax no internet access

    I finally got around to setting up my printer to work wirelessly.  Everything seems to be working ok on the home network.  I was also able to use the ePrint app on my iPad to print.  But...when I select a web service or try to register for efax it te

  • Interferance with cordless phone

    My Airtunes cuts out frequently while on the cordless phone. I have tried all the different settings (channels, robust signal, etc.) in the Airport Utility. Any suggestions? I don't use it for my internet. Only for Airtunes.

  • Segmented Control "Touch Inside" event is not firing?

    I think that Xcode has yet another bug as I don't know how in the world this event does not fire especially after doing everything by the book. I laid out the segmented control, turned on Assistant editor, right clicked the control, dragged the "touc