Run java when not installed on machine - java

I am working on a remote desktop connection. I am not allowed to install anything on it, so I have no access to java, but I need it for a task.
My theory is that I can install java on a network drive, which I can access from my remote desktop and then configure my GIT Bash so it knows where java is.
Is there a way to do this ? Havent found anything useful online....
EDIT: This also means that I can access java from PowerShell / CMD. I am just using GIT Bash most of the time...

Related

How to execute Carrot2 Document Clustering server

I downloaded the Carrot2 Document clustering server build 3.15.0 for Mac. The read me file says:
The DCS requires a Java Runtime Environment (JRE) version 1.7.0 or later. To
run the DCS, execute the 'dcs' script and point your browser at
http://localhost:8080 for further instructions.
Mac OS Sierra doesn't make it easy, but I got 1.8.0_112 installed.
The problem is that I don't know how to execute the 'dcs' script.
There are .cmd, .sh, .war, and .jar files. I wasn't sure which of those to work with. I thought .jar looked promising, so I followed some of this thread and tried this in a terminal window:
java -jar invoker.jar
I cd-ed to the correct directory, but it just says Provide main class, but I'm not sure what or where that is.
Can anybody provide instructions or a link to how to do this?
Use the dcs.sh (on Linux/Mac) and dcs.cmd (on Windows) to start the server. The scripts will set some extra options for the JVM and then start the DCS. In case of any problems, append the -v option to see diagnostic output.

How to compile and run a Java program from my Bluehost server

I have some space with bluehost and would like to run a java program that I wrote from it.
The problem is I don't think bluehost supports java. When I ssh in and then type javac -v I get command not found.
Is there anyway to export a java file into something that isn't a .jar that I could run this java program on the bluehost server?
If you want to run a java program on your bluehost server you have a few options.
Option 1. Get dedicated hosting, which probably costs way more, then you can get sudo access and you can sudo yum install java.
If you have dedicated bluehost hosting then:
Login to your Bluehost Control Panel
Click the Server quicklink
Scroll down to the Access Management section.
Click the Primary User tab.
Enable sudo
Option 2. Download java jdk in your local sandbox and install locally.
a. From bluehost terminal run command `uname -m` mine says 64 bit.
b. Go download the 64 bit linux JDK .tar.gz
c. untar it and install it to somewhere local.
d. Add an alias so that javac and java are reachable from terminal.
Option 3. Make your own server or virtual machine.

How can I run a Java GUI application on a headless Linux that does not support GUI?

I have created a Java GUI application that is running in Windows. Now I want it to run it on a headless Linux instance that does not support GUI. I wanted to convert the GUI to TUI. Is there a way I can substitute some classes and make it run in Linux by TUI. Please help.
You can use PeterMmm's suggestion http://www.pitman.co.za/projects/charva/index.html
Or, you can run the GUI on your local machine by running an X server, then connecting to the Linux box using ssh -X. That will show the GUI on your local machine, but the program is actually running on the linux box.
Or, you can run XVFB to fake a GUI on the Linux box. You won't be able to see the GUI or interact with it in any way, but that might not matter to you.
For the sake of spreading a simple and effective solution, I copy the answer provided by #fossfreedom on SA "Ask Ubuntu":
sudo apt-get install xvfb
then:
xvfb :1 -screen 0 800x600x8 &
export DISPLAY=":1"
java application_name.jar
or
xvfb-run -a -e /tmp/some/log/file.log java -jar /home/user/somejava.jar
-> see: https://askubuntu.com/questions/50599/how-do-you-run-a-gui-application-without-gui-gui-application-as-daemon-on-headl
There are some ncurses implementations for Java available like this one: http://www.pitman.co.za/projects/charva/index.html
If you are connecting from another X running Linux machine put following to your user ssh config (~/.ssh/config):
Compression yes
CompressionLevel 9
ForwardX11 yes
ForwardX11Trusted yes
Then when you login to remote Linux machine your GUI going to be forwarded to local screen. Note that it could be slow... notably some AWT applications are really slow even on LAN.
If on Windows, intall CygWin and its Xserver components. Also OpenSSH can be helpful. When you going to connect through CygWin's ssh, use the same config as above. Of course run Xserver prior connecting to remote machine. You also can use Putty to connect to remote, but don't forget to enable X11 forwarding and compression in session config.
Remote machine must have xauth installed + sshd must have X11Forwarding enabled. If OK echo $DISPLAY will show localhost:10.

unix - x windows/X11 question

I have a java GUI jar file that i need to launch at my unix terminal. My system admin says "X is already enabled via ssh". But when i type xterm it says
xterm Xt error: Can't open display: xterm: DISPLAY is not set
I did some reading and it says i have to login using
$ssh -X mylogin#xyz
So my question is:
1) What should i do next...i typed xterm again but the window does not launch
2) Suppose i get it working somehow. How can i launch my java GUI. (do i simply type the jar file name)?
Thank you all for your help.
I am assuming you are connecting from your own computer to some server running SSH. First off, you need to install an X11 server on your own machine if you don't have one already. The terminology here is confusing - if you're connecting to another machine by SSH, you're probably used to thinking of your own machine as the client and the remote one as the server. But in the case of X11, those roles are reversed.
Then, you'll need to start X11 on your own machine and within that, launch an xterm. Then from that xterm, you can run ssh -X myserver.example.com and once logged into that remote server, run java -jar myapplication.jar and it ought to work.
The specific mechanism for launching an X Server on your own machine varies by operating system. On Linux/FreeBSD/etc, you're probably running one already. On a Mac, X11 is available under Applications if you've installed the developer tools. On Windows you'll need something like Xming
Go to your unix terminal and do:
export DISPLAY=<ip_addr>:0
For e.g. I would do export DISPLAY=10.18.192.89:0.
The ip-address is of the machine where you want to see the GUI and that machine should have an Xterm client running.

Using RCP or FTP to copy files from a remote unix machine onto a local windows machine

I'm trying to write a piece of code that uses a ProcessBuilder to transfer a file on a remote UNIX machine onto the local Windows machine. On a brief bit of research I've found that either RCP or FTP should be a suitable thing to use.
Having done some research on the RCP command, I found instructions for copying files from a UNIX to windows machine, but they don't seem to work. The command I was told to use was:
rcp -r unixhost.user:/example/directory C:\Directory
However using this told me that C: was not a host. I tried it with the IP address, localhost, the alias of the windows pc in the hosts file but none of these worked, it either said permission denied or it could not connect to the host. Having looked up ftp it seems that would be another viable option. I'm not sure if I can execute a command using ProcessBuilder to successfully achieve this via FTP.
Would rcp or ftp be more suitable for this task? And how would I go about using them?
EDIT : To clarify, the script/batch file will be running on the Windows machine and pulling the files from the UNIX machine to windows.
It may be possible to escape the colon in the destination part. Have you tried quoting the destination?
rcp -r unixhost.user:/example/directory "C:\Directory"
It's been a while since I've done any command-line stuff on windows, but I remember the backslash character always being problematic. You may need to use forward slashes in the destination, since the rcp command is consuming the command line. You may also be able to use the backslash as an escape character, so you might try the following:
rcp -r unixhost.user:/example/directory C\:/Directory
If that won't work, you can explicitly set the current drive letter before calling the rcp command. If you're using a batch file, try the following two lines:
c:
rcp -r unixhost.user:/example/directory \Directory

Categories

Resources