Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Running java code on-line

Options
  • 20-07-2005 11:04am
    #1
    Registered Users Posts: 1,086 ✭✭✭


    I have code written in java which I run fom the command line. It is very basic just using vectors, arrays, taking in 2 user input values and displaying output. I want to run it somehow on my website however since my website does not support JSP, I need another way of running the code on the server.

    Maybe an applet but not sure how to make one....

    Otherwise what good programming language would be recommanded to translate the code into?

    Thanks in advance


Comments

  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    Look up applets, probably the best way to do it cause you wouldn't have to start from scratch.


  • Registered Users Posts: 1,184 ✭✭✭causal


    Peter B wrote:
    code java command line vectors, arrays, 2 user input values run on my website
    Let me guess: username and password

    You can either use Applet or JApplet, basically your main class needs to extend one of them - so all of your code should be reusable (bar calls to System.exit etc.). There are restrictions when using Applets for security reasons. An Applet should be handier - but I haven't done much with them. Use Suns Applet Tutorial

    hth,
    causal


  • Registered Users Posts: 1,086 ✭✭✭Peter B


    Thanks for the help guys.

    Not username and password, a random race schedule generator actual.

    Have made an applet which works fine. However my webspace (siteground) does not support java so I cannot run the applet. So I have been trying to find some free webspace to run the applet. I will just link to it from my site. Have found and signed up to a few but cannot compile my code because I cannot access the server command line through putty (ie javac applet.java). Have been emailing their support, no reply yet.....


  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    Have you thought about reading in the data from the user, rather than the command prompt?
    It would probably be less hassle.


  • Closed Accounts Posts: 8 philh1


    Hi there. Just some thoughts.

    An applet would not run on the "website" (i.e. on the machine that hosts your website), it would get downloaded to the user's browser and it would run there. That means two things, which may or may not help you

    1. If the applet needs to access something outside itself (a database would be a classic example), you're in trouble, and an applet is the wrong way to go.
    2. The guys who host your website don't need to 'support' applets, because they are not running the applet, the user downloading the page is.

    Don't worry about not being able to compile the applet on your host. There is no need. The same class files that you compile on your machine at home (or wherever you are doing the work), should be the ones you put up on the host site, and link to from your page. They will be downloaded to the user and run there. You don't need to compile it differently for different operating systems or environments, because the output of the Java compiler (the .class files) is portable to any machine that has a Java Virtual Machine (and users' browsers will have this).

    PHiL


  • Advertisement
  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    Yeah,

    The applet doesn't need to be recompiled. Compile it on your machine, and put the class file on the account, so you wont need to use the javac command.

    Where exactly are the inputs you want to take from the command line coming from?


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    Java WebStart (or whatever the current name is) may also be an option.


Advertisement