Running a Java application on a server.

I made a simple Java app that acts as a server. I can't figure out how to run it though (well, I can run it on my own machine of course, but that's no good). I've looked into servlets but I get the impression that a servlet is for the web, while I want to run a socket-based program. Do I need a special server, or is myjavaserver.com (for testing) good enough?
Thanks

I don't want to run the application on my home machine because I don't want to leave it on all day, my internet connection is not as fast as a hosting provider's, and I don't like leaving a port open all day (although probably nothing will happen).
So if I have a small app like import java.net.*;
public class ServerTest {
     public static void main(String[] args) throws Exception {
          int port = 12345;
          ServerSocket servSock = new ServerSocket(port);
          while (true) {
               Socket socket = servSock.accept();
               System.out.println("Connection to server established.");
} how would I run that on a hosting provider's server? At home I can just call "java ServerTest" from the command line, but for obvious reasons I cannot do this on a web server that I do not have physical access to.

Similar Messages

  • How can I run a java-application on starting of Windows 2000

    How can I run a java-application without any user on starting of Windows 2000?
    For example, if the computer is restarted and nobody enter into it yet, my java-application should run anyway.
    How can I do that?

    Hi, you have to put it in a Windows service.
    To do this you have a program, Srvany.exe that allow to insert a .exe or .bat program in a Windows service.
    For example, i develop a program, TomcatGuardian and i put it in a service because i need to run it in a server without Administrator logged in.
    Regards,
    Ivan.

  • How to run standalone java file from weblogic server on Solaris

    Hi,
    We have a requirement to run a java file at a scheduled time in a day using cron scheduler on our linux server.
    We need to fetch data from the database & perform some business logic in this standalone JAVA file.
    Our application has an EAR which is deployed on Weblogic 10.3 server & in our application, we are utilizing the datasource created in that domain.
    Now, we have created a standealone Java file & used exisitng datasource (without Hibernate) of the domain with the help of below forums,
    Use DataSource of weblogic in a standalone Java file
    able to achieve the same.
    I've bundled this JAVA in application WAR & depoyed on the same domain where datasource is created.
    Now, how can I execute this file from anywhere on the server using weblogic classpath.
    Please help on the same in implementation.
    Thanks,
    Uttam

    If the Java application must be stand-alone you must not deploy it on WebLogic, then WebLogic will manage its lifecycle.
    In this case you can use the CommonJ API and use the timermanager if it must run on a certain time. More information
    of how to do this can be found here: http://middlewaremagic.com/weblogic/?p=5569
    If you keep the Java application stand-only and want to use a cron job you can follow the example presented here: http://middlewaremagic.com/weblogic/?p=7065
    Note that the example runs a WLST script, but you can follow the same steps to run your Java application.

  • How do i run a java application in jdk1.3

    im trying to run a java application in jdk 1.3. I created it in jbuilder and i was trying to use the applet viewer.

    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/appletviewer.html
    Jesper

  • Running a java application from a java application

    hello ,
    please who knows how i can run a java application 'B' from inside another java application 'A' and get the error messages (if any) from the application 'B'

    how are you executing application B from application A? Please explain the java code you are using?

  • Running a Java application from a Swing GUI

    Hi,
    I was wondering if there is a simple way to run a Java application from a GUI built with Swing. I would presume there would be, because the Swing GUI is a Java application itself, technically.
    So, I want a user to click a button on my GUI, and then have another Java application, which is in the same package with the same classpaths and stuff, run.
    Is there a simple way to do this? Do any tutorials exist on this? If someone could give me any advice, or even a simple "yes this is possible, and it is simple" or "this is possible, but difficult" or "no this is not possible" answer, I would appreciate it. If anyone needs more information, I'll be happy to provide it.
    Thanks,
    Dan

    I don't know if it is possible to run the main method from another Java app by simply calling it...
    But you could just copy and paste the stuff from your main method into a new static method called something like runDBQuery and have all the execution run from there.
    How does that sound? Is it possible?
    What I'm suggeting is:
    Original
    public class DBQuery{
    public static void methodA(){
    public static void doQuery(){
    methodA();
    public static void main(String[] args){
    // Your method calls
    //Your initializing
    doQuery();
    }Revised:
    public class DBQuery{
    public static void methodA(){
    public static void doQuery(){
    methodA();
    public static void doMyQuery(){
    // Your method calls
    //Your initializing
    doQuery();
    // No main needed!!
    //public static void main(String[] args){
    // Your method calls
    //doQuery();
    //}

  • Running a java application in command prompt

    hi, I'm new to this forum.
    I would like to know what exactly needs to be specified to run a java application in a normal DOS command prompt.
    I know it is something like:
    javaw -classpath .\class GUI.applicationGUI
    where applicationGUI is the main class, right? What else do I need to do, since I have some other non-GUI classes that I need, inside the class folder ?
    Thanks for your time.

    You need to import those classes. And you need to make packages.
    In classes 1, 2 and 3 put:
    package class;
    In class 4 put;
    package class.GUI;
    Then you need to make the connection:
    In classes 1,2 and 3 put:
    import class.GUI.*;
    In class 4 put:
    import class.*;
    Compile each directory separately while in the respective directory. javac *.java
    Then go back to the directory above the directory "class" and run
    java class/GUI/name_of_file_containing_main_method

  • Is it possible to run a java application within a web browser?

    Hello everyone here! I have a question about running a java application within a web browser and I would appreciate it very much if anyone here can give me some answers.
    I have a standalone java application written with AWT. Basically this free application lets users to select spectral lines from a big file based on some criteria and plot those selected lines. Yes, it is a very simple application. Now I want to run this application within a web browser so that users don't need to download the application from the ftp site and thus don't need to install in their machine. Is it possible to run this application within browser? If yes, can we get the same plotting function as we run the application separately and where should I start out?
    Thanks in advance!
    kuilian

    Please see the signed applet discussion group for details of how to avoid the applet security restrictions. You can sign the applet, or use the policy file containing {AllPermission} for testing purposes (though not suitable for widespread deployment).
    Regards
    Matthew

  • Can we run a java application using Runtime.exec()?

    Can we run a java application using Runtime.exec()?
    If yes what should i use "java" or "javaw", and which way?
    r.exec("java","xyz.class");

    The best way to run the java application would be to dynamiically load it within the same JVM. Look thru the class "ClassLoader" and the "Class", "Method" etc...clases.
    The problem with exec is that it starts another JVM and moreover you dont have the interface where you can throw the Output directly.(indirectly it can be done by openong InputStreams bala blah............). I found this convenient. I am attaching part of my code for easy refernce.
    HIH
    ClassLoader cl = null;
    Class c = null;
    Class cArr[] ;
    Method md = null;
    Object mArr[];
    cl = ClassLoader.getSystemClassLoader();
    try{
         c = cl.loadClass(progName.substring(0,progName.indexOf(".class")) );
    } catch(ClassNotFoundException e) {
    System.out.println(e);
         cArr = new Class[1] ;
         try{
         cArr[0] = Class.forName("java.lang.Object");
         } catch(ClassNotFoundException e) {
         System.out.println(e);
         mArr = new Object[1];
         try{
         md = c.getMethod("processPkt", cArr);
         } catch(NoSuchMethodException e) {
         System.out.println(e);
         } catch(SecurityException e) {
         System.out.println(e);
    try {            
    processedPkt = md.invoke( null, mArr) ;
    } catch(IllegalAccessException e) {
              System.out.println(e);
    } catch(IllegalArgumentException e) {
              System.out.println(e);
    }catch(InvocationTargetException e) {
              System.out.println(e);
    }catch(NullPointerException e) {
              System.out.println(e);
    }catch(ExceptionInInitializerError e) {
              System.out.println(e);
    }

  • Java applications on EP server

    Hi EP Experts,
    I would like to know following things.
    1. How do I migrate Java applications on Portal server? (one way using JAVA PDK)
    2. What are the different problems that are faced during migration of Java code to EP server
    3. Do we need to import specific libraries that are used specific for Java applications and are not available with WAS/EP?
    If any one has similar migration experience please share the problems that are faced and if possible solutions you got for any.
    Thank you,
    Chintamani Chitnis

    Hi,
    Check this document
    http://help.sap.com/saphelp_erp2004/helpdata/en/88/bdfc3f48ecc742e10000000a1550b0/frameset.htm
    Regards,
    Ganesh N

  • Proble regarding running a java application

    hi guys
    i'm new to java environment .
    when i'm running a java application in a console ,
    it is not able to give output in other directories.it is working only in c:\j2sdk\bin.
    i think its the problem of setting classpath.
    can any one help me hw to run java program in any folder.

    You need to add that directory to your PATH. Follow
    the installation instructions more completely.Howdy sheriff Warnerja! How's life in the Schmuckville Home of the Ball-less? Any leads regarding the dot flasher case? I see you're on the PATH.
    Sheriff Warnerja of Schmuckville sensed an indecency plot.
    Here was someone exposing her private dot.
    He went on the trail,
    but of no avail:
    He didn't know where to find that intimate spot!

  • Running a Java Application in Windows

    Hi, Can anyone tell me how to run a Java Application in Windows? I've tried to run it using TextPad 4.5 but it gives me an exception saying it can't find a class defenition. I'm actually using IBM VisualAge for Java to develop the app and it runs fine INSIDE VisualAge and I've exported my compiled class files and so on, to run it stand-alone in Windows. I'm using some custom objects and inner classes, could these be the problem?

    YES! SUCCESS! I exported my class files from VAJ and along with the manifest file that it adds automatically. I opened up the jar with Winrar, extracted the manifest file and added the Main-class: header pointing to my executable and then put it back in the jar with winrar. And PRESTO! I can now run it with javaw! Thanks for your help peeps...

  • I want to run a java application once only.Pl help.

    i want to run a java application once only.
    i.e. if some application is running on Win NT OS then that
    particular appliaction again should not run,but other java application can run.
    Pl help with some sample code.
    Thanx.

    Hi,
    I if understood your question then your requirement is to run the application when the system is on.If this is the case then you can configure your OS schdular to do the job an let the OS do it.You can
    write the java code for this but that will require to run on the OS layer,so better to configure the schedular setting.....But then for some other requirement it cannot be useful....
    think...
    regards vicky

  • How do I run java application on IIS server

    Hi,
    Can I run java application on IIS(Internet information Server)?
    If yes, How do i do that?
    My java application contains JSP,Servlets and EJB.
    To run java application on IIS which plug in should i use.
    Can anybody help me This is urgent...........
    Thanx

    Hi
    Check this article on JGuru. It explains how to use Tomcat together with IIS.
    http://www.jguru.com/faq/view.jsp?EID=776546
    If you also need to use EJB's you probably also want to have a JBoss installed - check www.jboss.org
    /Peter

  • Running a Java Application on a Novell Netware Server

    I know this is a strange question but I was hopeing someone could help me or point me in the right direction. I have a java application that backs up files. I would like to run it automatically at night on our Novell server. Can Java run on a Novell OS. Any advice is appriciated.

    See http://www.javaworld.com/javaworld/jw-04-1998/jw-04-netware5.html

Maybe you are looking for

  • Help: Hotmail messages won't delete in Mail

    I've had this super annoying problem since I installed Leopard: whenever I receive a message on my hotmail account, it's impossible to delete, and it will keep showing up as unread everytime I throw it in the trash, until I finally delete it in my ho

  • After opening Mail, my iPhone 6 crashed and won't turn on, help!

    Today on my iPhone 6 (regular, not a 6 Plus), I had 39 unread emails (according to the badge). I wanted to check them but once I opened the app, it just turned off, and now I can't turn it back on. I tried holding the sleep button for a couple of sec

  • Podcast approval?

    I am currently trying to get my second podcast up on itunes.  This is the feed: http://feeds.feedburner.com/societyc3.   I know the feed works, and it successfully submitted and I got that email from itunes, but it's been nearly a week and I haven't

  • Today after a long time I tired to open photoshop CS5.1 on my mac, however it has vanished?

    Today after a long time I tired to open photoshop CS5.1 on my mac, however it has vanished and I am unable to find it anywhere on my system. I have recently done an update to my system so am unsure if this has affected it in anyway but the only thing

  • N79- can't send messages

    My N79 no longer sends the text messages I write... I was in Kenya for 4 weeks, it worked fine there both with my regular sim card and a Kenyan one. When I got to the airport in Istanbul I could no longer send messages. I tried again in Munich and th