How to start a RMI program

I have write RMI program the problem it's that I don't now how to start it
This is my Interface
import java.rmi.*;
import java.rmi.Remote;
public interface DataInterface extends Remote {
public String testRemote() throws RemoteException ;
This is my server
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
public class DataServer extends UnicastRemoteObject implements DataInterface {
DataServer() throws RemoteException{
super();
public String testRemote() throws RemoteException{
return "Merge obiectul remote";
public static void main(String[] args) {
System.setSecurityManager(new RMISecurityManager());
try{
//LocateRegistry.createRegistry(1099);
DataServer testServer = new DataServer();
Naming.rebind("//localhost/SERVER", testServer);
}catch(Exception e){
e.printStackTrace();
This is my client
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;
public class DataClient {
public static void main(String[] args) {
System.setSecurityManager(new RMISecurityManager());
try{
Remote remoteServer = Naming.lookup("//localhost/SERVER");
DataServer server = (DataServer)remoteServer;
System.out.println(server.testRemote());
} catch(Exception e){
e.printStackTrace();
And this is my policy file
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.net.SocketPermission "*:80", "connect";
All this files are in c:\temp and this directory is in my PATH variable. I've compilated the interface, server, client with
javac -classpath file.java
After that I generate with rmic the stub skel file in c:\temp. In this point I have all the files that I need. If is somebody kind to tell me from now what do I have to do to make this program work :)). Thanks for any help.

so..u have everything ready..
open cmd prompt and say 'start rmiregistry' - >this opens a new cmd prompt for rmi registry.let it run
now first run ur server by saying 'java DataServer' // include options as u like. this should be running without terminating.
now open new cmd prompt for ur client and say 'java DataClient '.
thats all.
if you want to run the client from a different machine, then try copying the client file into another m/c after changing the code from 'localhost' to the ip address of the server m/c. then just say 'java DataClient '
hope this works fine!

Similar Messages

  • How to start an executable program from a java program ?

    Hi,
    does someone know how to start an executable program from a JAVA program ?
    Thanks, Fred.

    Take a look at the Runtime class.
    -S-

  • How to start with Card programming !

    Hello,
    I want to learn card programming. For this i want to know few things.
    1) Where can i find an IDE to write program ?
    2) Do we get any simulator in it ?
    3) How to compile and run the card program.
    Right now i can not buy a reader or card. Just want to develop in simulator. How to start ?
    Please, help me. I do not know anything about it.
    Thanks,
    Abhijit Chandekar

    I want to learn card programming.http://developers.sun.com/techtopics/mobility/javacard/articles/
    Read "An Introduction to Java Card Technology" Part 1 to 3 for starting with java cards.
    1) Where can i find an IDE to write program ?The JCOP tools plugin for Eclipse is the cheapest IDE i know.
    http://www.zurich.ibm.com/jcop/products/tools.html
    2) Do we get any simulator in it ?Use CREF from the Java card development Kit or the JCOP emulator from the JCOP tools.
    3) How to compile and run the card program.See the Java Card Development Kit User’s Guide that comes with the Java Card JDK.
    @the other forum member:
    May be we should start creating a forum-FAQ which will be posted once a week. That would make it easier to help all the "newbies"...
    Someone interested?
    Jan

  • How to start 2 RMI servers on same machine ??

    Hello friends,
    I am developing databackup project USING RMI
    i want to start servers on same machine and client may be on different machine.
    we tried it used as on different port . but it stil not working.
    so can u provide me solution for that ,
    how to start that two server on the same machine. ?
    reply me soon
    thanks

    Ghanshyam,
    It is possible to run multiple RMI servers as long as the port is different. For instance if you run the RMI daemon using port 2700:
    rmid -port 2700and RMI daemon using port 2800:
    rmid -port 2800You will see these ports open if you do an nmap or netstat -aMake sure you bind your separate RMI instances on separate ports when calling Naming.bind()Anthony
    Message was edited by:
    abargnesi
    Message was edited by:
    abargnesi

  • How to start a simple program?? help

    i dunno how to start... i wanted to make a stackmat timer to my mobile phone (sony ericsson K750i),, and i don't have any idea how to do it.. can someone help me with this? thanks

    dijae wrote:
    i dunno how to start... i wanted to make a stackmat timer to my mobile phone (sony ericsson K750i),, and i don't have any idea how to do it.. can someone help me with this? thanksWhat do you mean with "I dunno how to start"?
    How much do you know and what do you want help with more specifically?
    Do you need help from the verry begining of using Java(e.g. a first hello world program) or help using JavaME for the first time? etc.

  • How to start a java program as a start-up service in Linux?

    i sucessfully started a java program by adding a script to /etc/init.d,
    but in the script, i have to type the full path of the java laucher, the environment variables are not loaded on startup, what should be done to avoid the full path in the script? Any one has a similiar experience or got a solution to share?

    I'm replying to myself .... ;-) ahah
    All we need for this purpose is JavaService, at link
    http://www.alexandriasc.com/software/JavaService/index.html

  • How to start a java program on another machine from one on my machine.

    During the next few weeks, I will be designing a grid computing system for a research project I am working on. The grid will be written entirely in java using java 2 SE. The question I have is, is there a way for the main program to remotely start the other programs on the other machines? I am very familiar with most networking concepts, but java is not my primary language so I was having trouble tracking down this feature if java even has it. Any suggestions you have would be greatly appreciated.
    thanks

    The administrators of each machine have agreed to install my java programs so that I may run my software. Worst case scenario I can have them manually start my program on each machine. The grid is to be the backbone of a very large simulation software to simulate around 18 million ISO shipping containers and the boats and ports they are on. The simulation will be used to test several security system designs. Because of the large scale of the problem, the solution has been decided to be a distributed system so that we can spread the load over a large number of systems. I understand the whole start a service on the other machines concept. I am looking for a way to start an already installed java program with as little human intervention as possible. The service idea will work. What I was looking for more specifically was a way to start the java virtual machine and run my code without having to leave a program running on their machine because like i said earlier they are personal machines. anyways if it is not do able I understand. Like I said, java is a second language and I don't yet know its limits or restraints.

  • How to Start Java RMI Server Application as Windows NT Service

    Hi!!,
    I have problem regarding the Installation of Java Application as NT Service this Java app in turn will start RMI Registry using LocateRegistry.createRegistry() at some specific port number. The Service is created successfully but i have problem regarding the Accessing of this Remote Object using Lookup() .(ie) I am able to get the RMI Registry Obj Refererce of the Java Rmi Application but couldn't able to Lookup for the Object registered to this Rmi Registry.I am not able to proceed after getting the Rmi Registry reference.
    So any help Regarding this is appreciated.
    Thanks in Advance.
    with regards,
    Ramakrishna M
    Mail: [email protected]

    Hello,
    I have started a Java RMI Server Application as NT Service using JNT (download it from www.eworksmart.com/JNT/ ).
    It is working fine.
    S. Navaneethakrishnan
    [email protected]

  • How to start work on program, first stepe (ezy explanation)?

    Good day everyone,
    My problem is Homework, I been lazy, so now I starting to work, but I have no idea, So, if anyone can explain or even write me couple first steps of this program,
    And if I can find somewhere solution, that be the best or if somebody think that is ezy, can you write me, please.
    Thank you
    Payroll.java
    In this program you are required to:
    -input your name
    -input the number of hours worked for each day from monday to Sunday
    -total the number of hours worked for the whole week
    -input the payrate per hour (Assume constant throughout the week)
    -calculate the overtime hours and over time pay. Any hours in excess of 40 is considered overtime hours. The overtime payrate is 1.5 times the normal payrate
    -output your name, total hours worked, payrate, overtime hours, overtime pay and gross pay

    Start yourself and ask specific questions where you are stuck and what the problem is. You Will not learn anything, if you copy and paste a solution a member provides here. If you show that you've tried and thought about it, you 'll get help here.

  • Does anyone know how to start a remote program by oracle

    I have a program which would load data from a bloomberg financial data termial. We only can load bloomberg data via their termial. So, we haven't any other choice to access bloomberg data (for example, it is impossible to access data using socket).
    However, because this program is a Excel application and our bloomberg terminal is not a private device, many person would use this terminal to view information and data. Obviously, this excel program would influence other user while this user try to open another excel program and want to edit data. I really want to schedule this program on specific time by the oracle database.
    Another reason is that if you want to use a excel applicaiton as a data loading background program, it would work on instable status, for example, sometime it would become no response status and we hard to find any reason.
    Is there any mechanism to shedule a remote program/task by oracle?

    Hi coppershen,
    IMHO you should think about alternative ways. I don't know Bloomberg services so I just give you some ideas to think about.
    1. Is there a useable web service to use. If so, you can use the webservice within your database
    2. Is there a service which will send you an XML or CSV file than you can import the data directly in your database.
    3. If you use a data terminal their could be the possibility to use any terminal emulation to access the data. It is a little tricky but than you can use a program to download the data and pump it in your database.
    Consider SQL*Loader as a better tool for loading data. It can interpret nearly any text data if it has a defined structure.
    I will stand by for further diskussions.

  • How do you start a java program with more RAM alloaction

    Hi
    can anyone please tell me how to start a java program to start with lots of RAM (RAM size is sent as a parameter), I have seen it somewhere and now I cant remember it. I have a server application to run this way.
    thanks and rgds
    sunil

    see the tooldocs of java: http://java.sun.com/j2se/1.4/docs/tooldocs/tools.html

  • Starting a java program on System boot/startup

    Hi,
    I am trying to find out how to start a java program on system startup which basically spawns a Thread which in turn does some processing.
    Came across windows specific options which help one make it as a service.Making a .bat for windows and .sh for linux could be a option but not sure where to put these in respective OS or whether it is a good option.
    If someone has tried out similar thing please let me know the details for the same.
    Regards
    Raj

    [codes]
    in command prompt
    type edit startupor somename.bat
    then type
    cd C:\Program Files\Java\jdk1.5.0_01\bin
    javac data1.java
    java data1
    and save
    [codes]
    copy startup.bat file
    and click on start-->programs--> startup(rigthclick and open)
    then paste that file into that folder...
    now you ll get that file opened whenever system boots.
    reply if this was usefull;)

  • How do I get a program to start up when I turn my computer on?

    You know how in the dock, there's a little triangle under a program that's technically running even if you don't have a window open? Dashboard and Finder always have that triangle after start up. How do I get another program, like Safari to "start up" with that triangel all the time even if I don't want to have the browser window open when I turn my computer on?

    Open the Accounts pane of System Preferences, add it to the list of login items for your account, and check the box to hide it. Some applications, such as Mail, ignore the box in Mac OS X 10.4 and are always visible when launched; in this case, an AppleScript can be used to hide them.
    (24829)

  • In Lion, running on an i MAC (late 2006), how can I stop certain programs from automatically starting up when I start my MAC?

    In Lion, running on an I MAC, (late 2006), how can I stop certain programs (iTunes, Word) from automatically starting up when I start the computer?

    Any application that is open when you shut down will re-open when you restart unless you deselect this when shutting down/restarting:
    Also check System Preferences>Users & Groups>Login items tab and make sure there's nothing listed there that you don't want launched.

  • A gap between letters started to show in my indesgn files. tried to undo with tracking, the paragraph settings. nothing helped. it ruins the fluent view of the document. how can i restore the program so that doesn't happen?

    a gap between letters started to show in my indesign files. tried to undo with tracking, then with the paragraph settings. nothing helped. it ruins the fluent view of the document. how can i restore the program so that doesn't happen?
    for example: say i write a paragraph. then, in a weird some sort of way an involuntary gap suddenly appears between different letters of random words(i did not recognize any pattern to the gap appearing) throughout the entire paragraph. once i've double clicked on that paragraph, and made a minor change, lets say tapped a 'space' key, and then clicked ctrl+z to undo, it has aligned(or fixed) the entire paragraph and made it look ok again. i've tried numerous ways to undo the entire thing, but cannot find the reason. i've been working for a few years and there's no reason why this thing all of a sudden should happen right now.
    if anyone has stumbled on something like that and can advise, i would welcome it.
    MNS-KG
    Vadim

    yep...i'm typing with hebrew. i'll make a printscreen with the settings you've asked for@:
    if you look closely you'll see that almost every line has a single letter apart. in hebrew there is no usually a singe letter structured words.

Maybe you are looking for

  • How to delete a row in ADF Table by pressing "Delete" Key

    I want to delete a row in my ADF table by pressing the "Delete" key..How can i achieve it?

  • Generating JSP/HTML on the fly

    Hi all, The requirement is to be able to generate HTML files (for UI display) on the fly depending on the database table structure. (Consider an EMPLOYEE table for example, an output HTML file needs to be generated based on the fields present in this

  • I want to change subject line and save emails from others

    For instance my client may respond to an email question and I want to change the subject line because it includes an answer such as clients address, but I cannot figure out how to change the subject line and save it to my file folder I have for them.

  • Mapping audit_id in process flow with parameter

    Hello! I have a following request. I would like to get AUDIT_EXECUTION_ID for certain Mapping in process flow and pass this ID to next mapping (all this with help of parameters I guess??) to get some data from AUDIT tables. How to do this? OWB versio

  • Underexposed LCD screen query

    Hi, I have just bought a used 5d and have a question that I hope someone may be able to help with.... I have an old manual focus lens with an EOS adapter that I have used on my other camera (450D) and everything works fine, but when I fit this lens t