Running java applications on any platform

Discussion in 'Java' started by rob hadow, May 9, 2004.

  1. rob hadow

    rob hadow Guest

    If a java application is successfully compiled to a .class file, what else
    is needed to run the application on another platform (assuming the platform
    has a JVM)?

    To put it simply, I compile my application, put the .class file on a CD Rom.
    Load the .class file onto another PC that does not have a SDK. What else do
    I need to do?

    I don't want to have to turn the application into an applet.

    Many thanks for any help.

    Rob Hadow

    PS Now that I have just passed the SCJP1.2 I want to gain some practical
    experience, as I have none!
    rob hadow, May 9, 2004
    #1
    1. Advertising

  2. Hi Rob,

    rob hadow schrieb:
    > If a java application is successfully compiled to a .class file, what else
    > is needed to run the application on another platform (assuming the platform
    > has a JVM)?


    You need to start it ;-)

    Of course you need the libraries that your application was compiled against.

    >
    > To put it simply, I compile my application, put the .class file on a CD Rom.
    > Load the .class file onto another PC that does not have a SDK. What else do
    > I need to do?


    Install the JRE.

    As I assume that your application doesn't consist of only one class file
    it would be nice to put them together in a jar.

    You can make the jar "executable" by specifying the Main-Class attribute
    in the jar's manifest. If you have additional libraries you can also
    specify the Class-Path attribute. Such jars can then be executed via
    java -jar myapp.jar and additionally under Windows by double clicking.

    >
    > I don't want to have to turn the application into an applet.


    If you are interested in web deployment, give Java Web-Start a try.

    Bye
    Michael
    Michael Rauscher, May 9, 2004
    #2
    1. Advertising

  3. rob hadow

    Roedy Green Guest

    On Sun, 9 May 2004 19:55:49 +0100, "rob hadow" <>
    wrote or quoted :

    >If a java application is successfully compiled to a .class file, what else
    >is needed to run the application on another platform (assuming the platform
    >has a JVM)?
    >
    >To put it simply, I compile my application, put the .class file on a CD Rom.
    >Load the .class file onto another PC that does not have a SDK. What else do
    >I need to do?


    You tell the person they need to install a Java JRE and point them to
    http://mindprod.com/jgloss/jre.html

    Or you can include the JRE download on the cd, but you had best check
    the licensing agreement to see if that is kosher.

    Normally you bundle class files into a Jar, rather than sending them
    into the world naked. See http://mindprod.com/jgloss/jar.html

    see http://mindprod.com/jgloss/jumptojava.html

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, May 9, 2004
    #3
  4. rob hadow

    Roedy Green Guest

    On Sun, 09 May 2004 22:03:13 +0200, Michael Rauscher
    <> wrote or quoted :

    >If you are interested in web deployment, give Java Web-Start a try.


    I distribute the Replicator both by CD and by web using JWS. It is a
    bit of a trick to install a JWS app from CD.

    You need a different JNLP file for each possible drive letter. I
    autogenerate them, plus a tiny C program that selects the right one on
    autorun.inf.

    see http://mindprod.com/jgloss/javawebstart.html

    see http://mindprod.com/zips/java/replicator.html

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, May 9, 2004
    #4
  5. rob hadow

    rob hadow Guest

    Many thanks for the info, very much appreciated. Rob hadow


    > If a java application is successfully compiled to a .class file, what else
    > is needed to run the application on another platform (assuming the

    platform
    > has a JVM)?
    >
    > To put it simply, I compile my application, put the .class file on a CD

    Rom.
    > Load the .class file onto another PC that does not have a SDK. What else

    do
    > I need to do?
    >
    > I don't want to have to turn the application into an applet.
    >
    > Many thanks for any help.
    >
    > Rob Hadow
    >
    > PS Now that I have just passed the SCJP1.2 I want to gain some practical
    > experience, as I have none!
    >
    >
    rob hadow, May 9, 2004
    #5
  6. On Sun, 9 May 2004 19:55:49 +0100, rob hadow wrote:

    > If a java application is successfully compiled to a .class file, what else
    > is needed to run the application on another platform (assuming the platform
    > has a JVM)?


    Michael and Roedy have given you the good stuff on
    Jar'ing and JWS, so I will merely add a 'gotcha'

    A Java programmer might code a string like..
    StringTokenizer st = new String(s , "\n\r");

    The problem is that "\n\r" is presuming a
    particular EOL delimiter. I mention it briefly here..
    <http://www.physci.org/codes/javafaq.jsp#xplatform>

    You will find a link to a document that will
    probably give you good Google fodder.

    HTH

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, May 10, 2004
    #6
  7. On Mon, 10 May 2004 00:09:21 GMT, Andrew Thompson wrote:

    > A Java programmer might code a string like..
    > StringTokenizer st = new String(s , "\n\r");


    .....errrrr. A Java programmer might make stupid typos..
    I will try that again.
    ......
    A Java programmer might code a string tokenizer like..
    StringTokenizer st = new StringTokenizer(s , "\n\r");

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, May 10, 2004
    #7
  8. rob hadow

    Andy Fish Guest

    don't forget the old java addage "write once, test anywhere"

    it's possible to write very portable java apps, but it's possible to write
    non-portable ones too

    "Andrew Thompson" <> wrote in message
    news:...
    > On Sun, 9 May 2004 19:55:49 +0100, rob hadow wrote:
    >
    > > If a java application is successfully compiled to a .class file, what

    else
    > > is needed to run the application on another platform (assuming the

    platform
    > > has a JVM)?

    >
    > Michael and Roedy have given you the good stuff on
    > Jar'ing and JWS, so I will merely add a 'gotcha'
    >
    > A Java programmer might code a string like..
    > StringTokenizer st = new String(s , "\n\r");
    >
    > The problem is that "\n\r" is presuming a
    > particular EOL delimiter. I mention it briefly here..
    > <http://www.physci.org/codes/javafaq.jsp#xplatform>
    >
    > You will find a link to a document that will
    > probably give you good Google fodder.
    >
    > HTH
    >
    > --
    > Andrew Thompson
    > http://www.PhySci.org/ Open-source software suite
    > http://www.PhySci.org/codes/ Web & IT Help
    > http://www.1point1C.org/ Science & Technology
    Andy Fish, May 11, 2004
    #8
  9. On Tue, 11 May 2004 11:33:05 GMT, Andy Fish wrote:

    > don't forget the old java addage "write once, test anywhere"


    ....errr. I have heard.
    'Write once, run anywhere', and the piss-take,
    'Write once, test everywhere'*, but not that variant..

    * An important thing to keep in mind when writing code..

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, May 11, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wolfgang
    Replies:
    5
    Views:
    1,450
    Tris Orendorff
    Feb 19, 2004
  2. jcc
    Replies:
    15
    Views:
    4,665
    Nigel Wade
    May 12, 2006
  3. Coca
    Replies:
    15
    Views:
    625
    Alan Balmer
    Jan 14, 2004
  4. Kaspar Schiess

    platform.rb (was: PLATFORM tests)

    Kaspar Schiess, Nov 25, 2005, in forum: Ruby
    Replies:
    0
    Views:
    109
    Kaspar Schiess
    Nov 25, 2005
  5. Jon Harrop
    Replies:
    8
    Views:
    133
    ara.t.howard
    May 30, 2007
Loading...

Share This Page