How to install Gradle into a Cloud 9 ide? - java

Does anyone know how I can to install Gradle into a Cloud 9 workspace?
These are my current instructions:
linux> wget http://services.gradle.org/distributions/gradle-1.10-bin.zip
linux> unzip -q gradle-1.10-bin.zip -d /usr/local/ # <== GET STUCK HERE
linux> echo "export GRADLE_HOME=/usr/local/gradle-1.10" >> .profile
linux> echo "export PATH=$PATH:$GRADLE_HOME/bin" >> .profile
But I get the following error when I type: unzip -q gradle-1.10-bin.zip -d /usr/local/
quinnliu#walnutiq:~/743682 (master) $ unzip -q gradle-1.10-bin.zip -d /usr/local/
checkdir error: cannot create /usr/local/gradle-1.10
Permission denied
unable to process gradle-1.10/.
checkdir error: cannot create /usr/local/gradle-1.10
Permission denied
unable to process gradle-1.10/getting-started.html.
Is there some kind of work around?

It looks like you do not have permissions to make changes to /usr/local. /usr is normally owned by root. The only way you can install there is to either use sudo or login as root. If you do not have root access, contact the support forum to request for this or that gradle is installed by support.
$ ls -lrt /usr
total 8
drwxrwxr-x 7 root admin 238 16 May 2011 bin
drwxr-xr-x 4 root wheel 136 29 Jun 2011 etc
gradle can run from anywhere. So instead do this. You will have access to your home directory (~). The home directory can be substituted for another directory.
cd ~ #Go to home directory
mkdir gradle #Create gradle directory
cd gradle #Enter gradle directory
wget http://services.gradle.org/distributions/gradle-1.10-bin.zip #Download gradle
unzip -q gradle-1.10-bin.zip #Unzip gradle
echo "export GRADLE_HOME=~/gradle" > ~/.profile
echo "export PATH=$GRADLE_HOME/bin:$PATH" > ~/.profile
source ~/.profile #Re-read your profile
Then your can run gradle --version to check that it is working. Run which gradle to check that the path is ~/gradle/bin

Related

jvm path not found on mac

I have installed java11 using
brew install java11
Then I tried the below to get JAVA_HOME
echo $JAVA_HOME
It returned empty .
so following the instructions in echo $JAVA_HOME returns nothing
when I have run ls -l /usr/bin/java
i cannot see any jvm path as shown in the above link. Below is what I got
~ % ls -l /usr/bin/java
-rwxr-xr-x 1 root wheel 168432 Dec 8 05:09 /usr/bin/java
ls -l /usr/lib/jvm/
ls: /usr/lib/jvm/: No such file or directory
How to set JAVA_HOME
If you're using bash, all you have to do is:
echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile
If you're using zsh (which probably means you're running macOS Catalina or newer), then it should instead be:
echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.zshrc
In either case, restart your shell.
If you have multiple JDK versions installed and you want it to be a specific one, you can use the -v flag to java_home like so:
echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 1.7)" >> ~/.bash_profile

Install Java 16 on Raspberry Pi 4

I have tried multiple releases from here using :
sudo -i
cd /usr/lib/jvm
wget [release link here]
tar xzf [file name here]
export PATH=$PWD/[dir here]/bin:$PATH
java -version
But after java -version I always get:
/usr/lib/jvm/[dir here]/bin/java: cannot execute binary file: Exec format error
Which means I have chosen the wrong release/architecture. Is there a release that works with Raspberry Pi's or is there another way to install Java 16?
Answering my own question.
cd [minecraft directory here]
wget https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk16u-2021-05-08-12-45/OpenJDK16U-jdk_arm_linux_hotspot_2021-05-08-12-45.tar.gz
tar xzf OpenJDK16U-jdk_arm_linux_hotspot_2021-05-08-12-45.tar.gz
export PATH=$PWD/jdk-16.0.1+4/bin:$PATH
java -version
You might have to do
export PATH=$PWD/jdk-16.0.1+4/bin:$PATH
after a reboot

How to remove ant?

First I ran these commands in my terminal to manually install ant.
# Let's get into your downloads folder.
tar -xvzf apache-ant-1.9.4-bin.tar.gz # Extract the folder
sudo mkdir -p /usr/local # Ensure that /usr/local exists
sudo cp -rf apache-ant-1.9.4-bin /usr/local/apache-ant # Copy it into /usr/local
# Add the new version of Ant to current terminal session
export PATH=/usr/local/apache-ant/bin:"$PATH"
# Add the new version of Ant to future terminal sessions
echo 'export PATH=/usr/local/apache-ant/bin:"$PATH"' >> ~/.profile
# Demonstrate new version of ant
ant --version
When I ran the last command, it showed an error. I then used brew to install ant which worked. Can I remove the first set of commands somehow? If so how? or does it not matter?
You need to reload the shell you are using, so .profile will get executed.
If you really want to use the same shell, you can run manually:
source ~/.profile

Jenkins Execute failed: java.io.IOException ant build

I have set up Jenkins on debianserver and I am trying to create the first android build but ant is not able to get invoked
In jenkins configuration I have:
Name: Java6
JAVA_HOME/usr/lib/jvm/java-6-sun
Name: AntHome
ANT_HOME/usr/share/ant
On the job config:
git > repo
Build step-
Ant invoke
Ant Version: AntHome
Targets: -d
build file: folder/folder/build.xml
When I build the job it gives me this error
[folder] $ /usr/share/ant/bin/ant -file build.xml -d
/var/lib/jenkins/workspace/Project/folder/folder/build.xml:47: Execute failed: \
java.io.IOException: Cannot run program \
"/home/dims/android-sdk-linux_x86-1.0_r2/tools/aapt": \
java.io.IOException: error=2, No such file or directory
I get the same on command line
jenkins#host:~/workspace/Project/folder/folder$/usr/share/ant/bin/ant -d
/var/lib/jenkins/workspace/Project/folder/folder/build.xml:47: Execute failed: \
java.io.IOException: Cannot run program \
"/home/dims/android-sdk-linux_x86-1.0_r2/tools/aapt": \
java.io.IOException: error=2, No such file or directory
It's happening with this particular project because I have created others and ant -d works: for example
jenkins#host:~$ android create project -n template -t android-10 -p Project -k some.pkg -a Some
Created project directory: Project
Created directory /var/lib/jenkins/Project/src/some/pkg
Added file Project/src/some/pkg/Some.java
Created directory /var/lib/jenkins/Project/res
Created directory /var/lib/jenkins/Project/bin
Created directory /var/lib/jenkins/Project/libs
Created directory /var/lib/jenkins/Project/res/values
Added file Project/res/values/strings.xml
Created directory /var/lib/jenkins/Project/res/layout
Added file Project/res/layout/main.xml
Added file Project/AndroidManifest.xml
Added file Project/build.xml
Added file Project/proguard-project.txt
jenkins#host:~$ cd Project/
jenkins#host:~/Project$ ant -d
Apache Ant version 1.8.0 compiled on M
....
[echo] unless 'nodeps' is used as well.
BUILD SUCCESSFUL
Total time: 0 seconds
This peculiar error happens when you attempt to run aapt (or a project that requires it) on a 64 bit system that is lacking some required 32 bit libraries, such as a default Ubuntu > 9. The solution is to install the ia32-libs package with
$ sudo apt-get install ia32-libs
Assuming you don't want to install close to 300 packages, run this instead:
$ sudo apt-get install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 --no-install-recommends

Error while installing RPM -%post script of spec-failed dependencies /bin/sh

I am trying to build RPM for my java code.RPM build and install sections works fine.But,later i have added a shell script in %post section to run shell script file that creates some files and starts the java application.The file gets copied fine.But, in %post section I get the failed dependencies bin/sh error.I am building the rpm on linux machine and target machines are centOS.I have also tried AutoReqProv: no in spec file.I am not running the install as a root user.also,target machines are not expected to have ANT(iam using it to build the java code-this might be not related to the problem) on them.I am attaching the code below.Default location of installation is in tmp folder.( for testing).
Summary: test Summary: test
Name: test
Version: 1
Release: 1
License: Restricted
Group: Applications/System
BuildRoot: ~/rpm/BUILD/helloworld-root
URL: http://mycompany.net/helloworld.tar
Vendor: Mycompany
Packager: Mycompany
Prefix: /tmp
BuildArchitectures: x86_64
%description
Hello World
%prep
pwd
%build
pwd
echo "changing directory"
echo $RPM_BUILD_ROOT
cd %{_sourcedir}
pwd
ant -f testbuild.xml
%install
pwd
echo "in install"
echo $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/tmp/test/
cd $RPM_BUILD_ROOT/tmp/test/
tar -xf %{_builddir}/test.tar
%post
sh /tmp/test/createdb.sh
%clean
%files
/tmp/test
%changelog
i have also searched on google but couldn't find how to run shell script from spec.with oust post section, I have tried to run through command line it executes fine.I appreciate the help if somebody can point where the problem is?
%post -p /bin/bash
That will give your post script a terminal to run bash commands and all that you are doing into it.

Categories

Resources