Results 1 to 6 of 6
  1. #1
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    160
    Rep Power
    5

    Default is jre is only necessary to run a java program

    hi
    i created a webservice server(sample)in java,need to run,standalone java webservice,on another computer.in that machine there is no jdk installed but jre is there ,so if i copied the .class file and how can i run the same in that machine,do i need to install jdk along with those classes

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,860
    Rep Power
    8

    Default Re: is jre is only necessary to run a java program

    What happened when you tried?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    160
    Rep Power
    5

    Default Re: is jre is only necessary to run a java program

    thanks for reply,
    i didn't test that,sorry,if i compiles a class,javac Sample.java,that will give class,and i send that class to my friend by mail where no java is installed only jre,i think jre will be installed by IE or Mozilla.
    and if i type java Sample,what will happen
    one more doubt.we can write throw new RuntimeException(); it wond ask for throws clause in method or try catch,but if i use throw new IOException(); its asking for try catch or public static void main(String[] args) throws IOException
    why this and what is the use of RuntimeException,where ever we put this it will throw exception,so to throwing exception manually we use this or what is the purpose.
    thanks

  4. #4
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: is jre is only necessary to run a java program

    RuntimeException and anything that extends it are not checked by the compiler, because in practice they cannot be. Hence the name RuntimeException.

    There are two schools of thought about exceptions. The practice originally encouraged by Sun is that you should throw checked exceptions like IOException and force the caller to deal with (or at least explicitly ignore) the problem that caused the exception. The other school of thought, which I only recently learned about in an O'Reilly Android book, says that you should wrap all checked exceptions in unchecked exceptions and re-throw them. I don't know the reasoning behind the latter. It sounds completely stupid to me, but maybe someone else can explain it.
    Get in the habit of using standard Java naming conventions!

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,860
    Rep Power
    8

    Default Re: is jre is only necessary to run a java program

    Quote Originally Posted by kjkrum View Post
    Get in the habit of using standard Java naming conventions! (Except #7 and maybe #8. Those are kind of dumb.)
    Slight nitpick that has nothing to do with this question: the link in your signature seems to be to a company's coding conventions, not standard Java conventions. Some of the rules (such as adding an underscore to class variables and having arguments named after their type) are not standard Java conventions, just that company's rules. It might be better to point people to the actual conventions: Code Conventions for the Java Programming Language: 9. Naming Conventions
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: is jre is only necessary to run a java program

    Thanks. I've been meaning to change that.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 4
    Last Post: 11-21-2012, 01:19 PM
  2. Replies: 4
    Last Post: 07-30-2010, 12:25 PM
  3. execute java program within java program
    By popey in forum New To Java
    Replies: 2
    Last Post: 10-22-2009, 05:32 PM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 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
  •