I need to start RMI server object java code from another java executable. When I try to run the main java program which calls the RMI java program using exec() function, I get ClassDefNotFound error. I am using eclipse. However, if i run the RMI program directly from console it works.
Can someone please help me to solve the issue.
Thank you
I need to start RMI server object java code from another java
executable.
Why? Why write two programs when one will do? Just export the remote object(s) from the 'other' Java program.
Related
I have created a server client programm in java in netbeans but now i want to run it in jgrasp but jgrasp is not allowing me two run both the classes i.e server and client at the same time. pls help me out with this.
You can only run one thing at a time in jGRASP. You'll have to start one or the other at the command line.
I want to know if there is some way to execute a jar console application by Delphi and give commands for it like a cmd.
Actually I have a java application that I don't have the source anymore and it's limited to only two commands by console, so I want to create a delphi application and it will have buttons instead console commands.
There is a way to do this?
I am trying to call matlab executable file from java application
i am try 2 option:
Process p=new ProcessBuilder("C:\\Users\\Dexter\\Documents\\MATLAB\\Project.exe").start();
Process p= Runtime.getRuntime().exec("C:\\Users\\Dexter\\Documents\\MATLAB\\Project.exe");
... these 2 options are work properly for another application like chrome, eclipse, et cetera
pls suggest the solution
I suppose that you are trying to run an executable exported from Matlab, within Java. I am not sure that this is going to work...
What you can do is to use the matlabcontrol library in order to open a session with Matlab and then you will be able to run Matlab commands directly, from Java, or run a Matlab script from Java, by giving some inputs and taking back the result from Matlab. I have created a server which does all the aforementioned, in Java, and using matlabcontrol library to connect with Matlab. You can find it here:
Connect Java with Matlab
Let me know if you need any further clarification.
Q. Is there a way to have a java program run twice on a mac like on windows?
You do not specify if you want to start a simple .jar or an application-bundle so I will give examples for both. To run multiple instances of an application-bundle on OS X, you can use the following trick; open the Terminal and start the application with this command:
open -n /path/to/your/java.app
Each time you call this command, a new instance is opened up.
Attention: Just because it is possible to start several instances does not mean it is a good idea to do so. Make sure you will not run into trouble with concurrent write-access of multiple instances with the same file.
If you are trying to run a jar, you can simply call
java -jar /path/to/your/java.jar
several times to start up several instances.
To start up the java-application from inside a java-application under OSX, you have to do something like this:
In the case of a simple jar:
File jarFile = new File("/path/to/your/jarFile.jar");
Runtime.getRuntime().exec(new String[] { "java", "-jar", jarFile.getAbsolutePath() });
In the case of an application bundle:
File jarFile = new File("/path/to/your/jarFile.app");
final String[] command = { "open", "-n", jarFile.getAbsolutePath() };
Runtime.getRuntime().exec(command);
I don't really understand the problem. But why don't you abstract it to a method instead of naming it program and call that subroutine twice. Or spawn two threads?
Maybe this is a trick question, but I would open up two terminal windows and run it once on each terminal...
This depends on the nature of your Java program. If your program is running as both server and client, it may cause the problem when your run multiple instances. In many server program, it uses a fixed port number to simplify the setting and implementation. Since a given port number cannot be use by more than one application, you cannot open more than one instance of that application unless you can change the port number in your application settings.
Many Java application uses this trick to prevent user to open multiple instances of their program by checking if a certain port is in use. If this the case, then you cannot run more than one instance of the program.
For other Java application that do not use port or ports do not crash, you can open it twice or more via the terminal.
Assuming that you are running client version of the code on your system and trying to connect to a host. First you need to have the server running on both the machines, B and C in your case. Secondly the client code you are using should be reading the IP address and port to connect. It should not be hard coded or else you will have to change the code and rebuild it for server B. This should help you.
Guess I have answered your query.
:)
I want to facilate my client to run java program through UNIX command prompt using some shells. It'll look more effecient if they would be able to give input through some GUI. So it can be tested immedietely. I dont want prefer unix commands fro input.
Can somebody tell me how to run Java swing or applet programs in UNIX?
As Thompson mentioned, looking at Java Web Start could be a good idea.
Otherwise, if what you want is to execute, using a *NIX-like terminal, an application located on a remote host and have it rendered on your local display, then you need to do a few things:
you need a working X server on the local machine
you need to export the DISPLAY to the local machine (you can do this by setting up the DISPLAY environment variable on the remote system)
then you need to start your Java app from the command-line.
Hope this helps.
Here's an example of how to export your display over SSH.
Java programs use the X windows system (just like any other GUI on Unix). Assuming your X windows system is setup correctly, you should just open up a JFrame and do your GUI coding just like Windows.
Using the command prompt to launch a GUI is so last millennium. If you can distribute from a server, look into Java Web Start to provide the end-user with a simple and painless install.
Oh, and of course, follow Starkey's advice to throw a JFrame into the mix.
If you have an X-server installed locally, Putty can tunnel the X11-graphics generated by Linux Java back from the server to your local machine, and view it there.
If the above doesn't make sense to you, your next best bet is either running the Java code locally with Java Web Start (and code it to communicate back to the remote server) or run Servlets inside a Java Web Server running on the remote host.
In other words, GUI over a Putty connection is not something which is easily done.