I am running Matlab without the Java graphical interface (matlab -nojvm) and I would like to get an email when a script finished running (I am running tons).
I tried using sendmail and matlabmail but both require Java. I also tried using the Linux command mail but it doesn't work. Do you have any tips on how to solve the problem?
You can suppress the graphical window without loosing java functionality by using matlab -nodisplay. This way, sendmail still works in my case.
Related
I am trying to experiment a bit with JSch library in order to create a simple Java app that gets a remote shell.
I used this example as reference:
http://www.jcraft.com/jsch/examples/Shell.java.html
which works fine but autocompletion of commands is not supported.
I am executing my jar from cmd/Windows and the remote shell is a Linux machine.
I don't get any error messages or warnings.
In the example it says something about lacking terminal-emulation. Is this maybe the issue? Any advice on how I can bypass this issue will be appreciated.
For autocompletion, you need to implement terminal emulation. It is not implemented by JSch.
See also Displaying Midnight Commander screen in JTextPane.
I executed a Java program from the command line in terminal app A. I want to move the console to terminal app B without having to exit and re-execute the program.
I can think of a few potential ways to solve this, ranging from:
A) In Java implement a new InputStream and OutputStream that somehow can be wired to a new process started in terminal app B.
...to
B) Find a way to put the main Java process in terminal app A in the "background" so that original process can be reopened in a terminal app B.
Ideally, I want to be able to "log in to" and "log out of" my Java process from any terminal on my computer. Has anything like this already been accomplished, and which approach would be best to make it myself? I am open to solutions that involve Java code, shell scripts, or both.
My specs:
OSX: 10.12.4
Usually running zsh on iTerm
If I was using Linux, the perfect solution would be reptyr, a command line tool that allows you to easily switch terminal windows.
On Mac, the best solution I have found is screen. It can also be used to switch terminal windows but must be invoked before running java in order to work and seems a lot more complex.
I have a little question: we have to run Java programs and parts of the code will be uploaded by the users.
So I want to know what's the best way to run them? I know 2 possible ways,
exec("javac Usercode.class") and then run the whole thing with exec("java Main"), but I tried it with exec() and it don't work. maybe because the http is not root? But I don't know exactly why.
http://php-java-bridge.sourceforge.net/pjb/ ?
Any suggestions?
And another question is, how can I run these programs in a sandbox. we have a Debian server and so it's no problem to execute the command with a limited time, but is there a possible way to run the whole code in a sandbox?
Ideas for sandboxing:
Run in a chroot using e.g. Debian's schroot command. Protects against them accessing files outside of the chroot but not against them doing things like opening sockets etc.
Each user has their own Linux username against which they validate. Commands will then be run under the appropriate username (e.g. by using sudo or a set-uid executable).
Maintain a pool of virtual servers - expensive and complicated but gives best isolation.
Is it possible to have several command prompts running simultaneously and switch between them, without using a GUI?
Background
I have installed CentOS-5.5-i386 without any extras, so I have a bash command prompt with root access but no GUI as far as I know.
I have written a simple Java servlet using Jetty. When I run it, it gets to a couple of commands like this;
server.start();
server.join();
where it waits for incoming requests forever - ie. it never returns to the command prompt.
I want to run a web server without the overhead of a GUI. How can I run my Java program and also continue to use the server from a command prompt?
I apologise for the waffly nature of this question but I am both a Linux newbie and a Java newbie.
Regards,
Nigel
In the general case you want screen or tmux. For running daemons, though, take a look at nohup my-daemon & or even just my-daemon &.
You can switch between consoles using Alt+F1 to Alt+F6. For more shortcuts take a look here: http://linux.about.com/od/linux101/l/blnewbie5_1.htm
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.