Results 1 to 14 of 14
  1. #1
    Valkyrie is offline Member
    Join Date
    Oct 2009
    Posts
    15
    Rep Power
    0

    Default Running a Java Program

    How do you know that the computer that you are going to execute the Java Program can be executed by the computer?

  2. #2
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    hmm...i didnt get you. can you explain it?

  3. #3
    Valkyrie is offline Member
    Join Date
    Oct 2009
    Posts
    15
    Rep Power
    0

    Default

    Ok, how can you tell if the Java program can be executed by the computer?

  4. #4
    logicbug's Avatar
    logicbug is offline Member
    Join Date
    Jan 2009
    Location
    The Great White North, eh?
    Posts
    76
    Rep Power
    0

    Default

    check that the machine has the newest version of the Java Runtime Environment installed... if it doesn't than install it.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Which operating system you are using? If it's windows, then open the command prompt and then type the command java -version. If there is any Java installation you can see relevant details on the prompt.

  6. #6
    Valkyrie is offline Member
    Join Date
    Oct 2009
    Posts
    15
    Rep Power
    0

    Default

    I'm running Windows Vista right now. I tried to run my_java_test.class program on command prompt, but I get that Windows cannot run my_java_test.class program.

    Do I need to download something else for my computer and any other computer that I'm planning to run my Java program? I have JDK on my computer, but I can't run the .class program.

  7. #7
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Post the exact error message that you got.

  8. #8
    abimaran is offline Member
    Join Date
    Nov 2009
    Location
    Colombo, Sri Lanka
    Posts
    22
    Rep Power
    0

    Default

    Just type :java in ur command prompt, If it give some datails about java command, then it(computer) can 'understand' ur java class files.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Complete error message is really helpful to us, answering to your question. And also, did you try what I say in previous post? If so what happen when you execute it?

  10. #10
    chirag.jain18 is offline Member
    Join Date
    Oct 2009
    Posts
    4
    Rep Power
    0

    Default

    Here are few things to consider:


    1. when you run your program, dont use .class. Type
    Java Code:
    java my_java_test
    in command prompt, NOT
    Java Code:
    java my_java_test.class
    2. set your PATH and CLASSPATH correctly in system environment variables.Like for my system:

    PATH=C:\Program Files\Java\jdk1.5.0_15\bin;
    CLASSPATH= C:\Program Files\Java\jdk1.5.0_15\lib;

  11. #11
    Valkyrie is offline Member
    Join Date
    Oct 2009
    Posts
    15
    Rep Power
    0

    Default

    Ok I got it to execute on my computer, thanks for the help.

    On a small note, if I want to run the program on another computer, what does the computer have to have in order to run it?

  12. #12
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    The JRE.

  13. #13
    Valkyrie is offline Member
    Join Date
    Oct 2009
    Posts
    15
    Rep Power
    0

    Default

    Is there a portable JRE that I can take with me on my Flash Drive so I don't need to install it for every computer that doesn't have JRE?

  14. #14
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Error running java program using URL
    By gio123bg in forum New To Java
    Replies: 6
    Last Post: 06-30-2009, 07:26 PM
  2. error running java program
    By bdasilva in forum New To Java
    Replies: 1
    Last Post: 06-29-2009, 02:46 AM
  3. Replies: 1
    Last Post: 01-12-2009, 09:59 AM
  4. [SOLVED] opening/running a program from java
    By xcallmejudasx in forum New To Java
    Replies: 3
    Last Post: 11-25-2008, 09:12 AM
  5. Replies: 0
    Last Post: 04-04-2008, 03:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •