How to use google batch upload in linux - java

I have read this article
http://lifehacker.com/5354441/google-docs-batch-upload-eases-online-document-transfers
java -jar google-docs-upload-1.2.jar /home/kevin/uploads --recursive
now its not working it says bas command not found.
is java already installed in vps centos or i have to install it

Either you don't have java or its not available in your path. Some linux distros install java in the /opt directory. So be sure to check if that's the case with you. If so then its just a matter of updating your path if not then there are two possibilities :
1. You have root access.
2. You don't have root access.
If you do have root access then you can easily install java with your package manager, if now you can still install java as a local user. Read this to do that. You can install any version of java that you so wish, also it may be unnecessary to install JDK, just JRE might be enough for you.
Don't do the steps that need root access, just copy it somewhere in your home directory or any of the directories to which you have access. Then set the appropriate values for JAVA_HOME and your PATH. It should work then.
If you need any help in doing that feel free to ask.

Download the jar google-docs-upload-1.2.jar.
Ensure you have Java.
Use your own home- and upload-folder, not the "kevin/uploads" one.

Related

Could not find or load main class com.nabinbhandari.lam.Main

I've read a lot of troubleshooting for similar occurrences of this error, but what is causing it for this particular .jar?
https://download.cnet.com/android/nabin-bhandari/3260-20_4-10982661-1.html
It works on Windows, but when attempting to run the file on a raspbian (linux) system running java version 1.8.0_65 with the command java -jar Local\ Area\ Messenger\ Desktop.jar it throws the error about not being able to find or load the main class.
The MANIFEST.MF defines Main-Class: com.nabinbhandari.lam.Main and there doesn't appear to be any issues with case sensitivity.
What am I missing? Do I need to install something more than Java Runtime Environment?
Edit: In case it is not clear, I am not the developer of this file. I am simply a user trying to run the file. This question has nothing to do with Eclipse and I don't understand why people are linking to that other question. I am not running Eclipse. Please stop linking to that. Please examination the .jar file I have provided.
Edit 2: I have followed the instructions and in this answer:
https://stackoverflow.com/a/1238173/2407742
It gives the error no main manifest attribute, in test.jar
Is there something missing from my java runtime environment? It seems like nothing works.
The Local Area Network Messenger application was developed using JavaFX, which is not included in the Oracle Java build for Rasperry Pi. I had to reinstall Java and then openjfx by doing the following:
sudo apt-get purge openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre
sudo apt-get install openjfx
It runs fine now.
The solution to this was the following:
Close Eclipse/STS
Use a file explorer on your operating system to navigate to your workspace (In my case, I'm on Windows so I used Windows Explorer)
Delete the .metadata directory (or to be safe, copy the directory somewhere else to be safe, then delete it)
Restart Eclipse/STS
Is there a more improved answer than this? I don't want to look like I'm trying to boost my own reputation points, so if someone can provide a better answer then please do so.

Download (only) OpenJDK and not install it

I do not wish to change my host's notion of what Java is, only download one or more JDKs including OpenJDK. I need to test and compare JDKs as part of a build system.
Just as I am able to download and then not install Oracle JDK with no problem, I need to download and not install a copy of open JDK. The website http://openjdk.java.net/install/index.html doesn't offer this possibility.
Has anyone found a solution to this?
The easiest way to do that would be to download OpenJDK source code and build it. For 8, it basically boils down to cloning the right set of trees and then doing the regular build steps:
cd /path/to/where/you/cloned/jdk8u
mkdir build
bash ../configure # not ../configure because configure is not marked as executible
make all
Look under build/ and search for a j2sdk-image directory. That's your jdk:
cp -a build/images/j2sdk-image /location/where/i/put/my/jdks/
The distribution packages of OpenJDK often include various changes that make it not suitable for moving around (liked tweaked RPATHs). That said, if you are feeling up to the risk, you can do something like:
yum --download-only install 'java-1.8.0-openjdk*'
Now you have a bunch of RPMs. Extract them manually:
rpm2cpio ./name.of.rpm.x86_64.rpm | cpio -id
You should see usr and other fumnny looking directories in the current working directory. Go through the, find the OpenJDK dir and move it over to some other location. For example:
cp -a usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b16.fc24.x86_64/ /location/where/i/put/my/jdks/
Note that it's usr/, not /usr/. Strip non-$ORIGIN RPATHs if you see on any ELF files.
Something similar probably exists for Debian/Ubuntu, but I am not familiar with them.

CMake can't find Java because of Cygwin

A user of my software is running Windows with Cygwin installed, which provides access to the standard GNU which command. In my CMakeLists.txt there is a line that reads:
FIND_PACKAGE( JAVA REQUIRED CONFIG )
This fails on his machine, because both JAVAConfig.cmake and java-config.cmake (executed by FIND_PACKAGE) use this command as a first-line attack in locating Java. The command returns a bad path to a non-existent install of Java. What can I do to override this annoying behavior from my CMakeLists.txt?
Ask him to send you his "path" env. variable, you will find something interesting there for sure.
Other issue is Java installations.
Ask him to unstall old javas or just update to newest, current installer removes older copies.

How does one unpack a file using zsh?

I am a RHEL user, and have to use Zsh for my work.
I am trying to unpack the rt.pack file in order to correct an incorrect java installation.
The command
/usr/bin/unpack200 rt.pack rt.jar
does not seem to be present in Zsh.
Can someone please tell me what the equivalent command in Zsh might be?
I don't own a RHEL laptop anymore, but what you need to do is likely just install Java (using the the RHEL package manager).
Otherwise just do a local JDK install and use it from there.
PS; you can always try locate unpack200 to see if it is anywhere in your system or not.
Here's what worked finally: A clean installation of the rpm that had the jdk in it.
rpm -Uvh <name of jdk>.rpm
This extracted the appropriate files and placed them in the right paths.

Install Java Web Start from an Application

I have a simple Java program that uses:
Runtime.getRuntime().exec("/usr/bin/javaws", [path for JNLP file])
to open a JNLP file using java web start.
However, I need to deal with the scenario of javaws not being installed. So I need to check to see if it is installed and, if it's not, install it. Any idea how to do either of those (or both)?
Firstly, you're assuming that the path to javaws is /usr/bin/javaws, which may not be the case.
If it were that simple, then you can check if the file exists:
File javawsFile = new File("/usr/bin/javaws");
if (! javawsFile.exists()) {
System.out.println("javaws not installed");
}
Having said that, java does not have to be installed to any particular location. Thus you can't assume it's in /usr/bin/. Many people will download the java binary zip and simply decompress it to their choice of location, and set the environment variable JAVA_HOME.
Now, you could go down the path of resolving the JAVA_HOME variable - but even then it'll only tell you if javaws is installed - or not.
If javaws is not installed, there is not really a way to install it - other than prompting the user to go off to the java website and download it.
The path you give is in *nix style. In this case it would require root access to install new applications - which isn't something you can simply manufacture.
Even if your user was already running your application as root, I would still be wary of this. It's not your responsibility to install software on your users' machines.

Categories

Resources