I am trying make a docker image of a java project. I first created a directory and in that I created a docker.txt file. The files contains this
FROM java:8
# Install maven
RUN apt-get update
RUN apt-get install -y maven
WORKDIR /home/mmt/CouchBaseClient/CB-RestAPI/CouchBaseThinClient
# Prepare by downloading dependencies
ADD pom.xml /home/mmt/CouchBaseClient/CB-RestAPI/CouchBaseThinClient/pom.xml
RUN ["mvn", "dependency:resolve"]
RUN ["mvn", "verify"]
# Adding source, compile and package into a fat jar
ADD src /home/mmt/CouchBaseClient/CB-RestAPI/CouchBaseThinClient/src
RUN ["mvn", "package"]
EXPOSE 4567
CMD ["/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-jar", "target/sparkexample-jar-with-dependencies.jar"]
and then I run in terminal the following command
docker build -t API .
I get the following error
invalid value "API" for flag -t: Error parsing reference: "API" is not a valid repository/tag
See 'docker build --help'.
Docker is complaining about "API" in the sense that it's not allowed to have a tag name with one or more character in uppercase:
$ docker build -t FOO .
repository name component must match "[a-z0-9](?:-*[a-z0-9])*(?:[._][a-z0-9](?:-*[a-z0-9])*)*"
Usually "recipes" to build Docker images are written in a file named Dockerfile, anyway you can continue to use docker.txt using the -f option:
docker build -f docker.txt -t api .
I'm trying to compile a tool which uses apache ant on linux
https://github.com/lindenb/jvarkit
When I tried to compile the tool , I get n error.
$ make vcffilterjs
this is what I get when I'm running the command
echo "Compiling htsjdk with ${JAVA_HOME} = /usr/lib/jvm/java/jre/"
Compiling htsjdk with /usr/lib/jvm/java/jre/ = /usr/lib/jvm/java/jre/
echo "Compiling htsjdk library for java. Requires apache ANT. If it fails here, it's a not a problem with jvarkit."
Compiling htsjdk library for java. Requires apache ANT. If it fails here, it's a not a problem with jvarkit.
echo "And ${JAVA_HOME}/bin/javac should be >=1.7"
And /usr/lib/jvm/java/jre//bin/javac should be >=1.7
(cd /home/jannahS/jvarkit/htsjdk-1.139 && ant )
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
make: *** [/home/jannahS/jvarkit/htsjdk-1.139/dist/htsjdk-1.139.jar] Error 1
I have installed apache ant and tried to set ANT_HOME following google instruction
export ANT_HOME=apache-ant-1.9.6
ANT_OPTS="-Xms256M -Xmx512M"
PATH=$PATH:$HOME/bin:$ANT_HOME/bin
export ANT_HOME ANT_OPTS PAT
I also have set JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/jre-1.7.0
export PATH=$JAVA_HOME/jre/bin:$PATH
When I run
ant --execdebug
exec "/usr/lib/jvm/java/jre//bin/java" -Xmx256M -classpath "apache-ant- 1.9.6/lib/ant-launcher.jar" -Dant.home="apache-ant-1.9.6" -Dant.library.dir="apache-ant-1.9.6/lib" org.apache.tools.ant.launch.Launcher -cp ""
Buildfile: build.xml does not exist!
Build failed
I don't know what else to do to make things to work. I can't compile the tool that I want to use without apache ant
Use full path in ANT_HOME, eg:
export ANT_HOME=/usr/lib/apache-ant-1.9.6
It dependes where it is exactly located
Could not find or load main class org.apache.tools.ant.launch.Launcher
In mac this is due to some environment issue if you install the ant using brew command,
copy the lib folder from the ant and paste it into the bin folder
now run the command issue is resolved:-)
issue reason
ant is trying to get the bin/lib/ant-launcher.jar file from the invalid path
In Mac, after running brew install ant, I had to run brew link ant to fully link ant to system environment.
Running brew link --verbose --overwrite ant I get:
Linking /usr/local/Cellar/ant/1.10.5...
ln -s ../Cellar/ant/1.10.5/bin/ant ant
ln -s ../Cellar/ant/1.10.5/bin/antRun antRun
ln -s ../Cellar/ant/1.10.5/bin/antRun.pl antRun.pl
ln -s ../Cellar/ant/1.10.5/bin/complete-ant-cmd.pl complete-ant-cmd.pl
ln -s ../Cellar/ant/1.10.5/bin/runant.pl runant.pl
ln -s ../Cellar/ant/1.10.5/bin/runant.py runant.py
6 symlinks created
And when running "ant" with no params from command-line:
Buildfile: build.xml does not exist!
Build failed
Which is what I expect if testing outside the context of an existing ant project.
Run "which ant" >> to know if the ant_home set. If not please run below with your corresponding paths to set ant_home
export ANT_HOME =/ade_autofs/gd29_3rdparty/ANT_1.7.1_GENERIC.rdd/080925/ant
export PATH=/ade_autofs/gd29_3rdparty/ANT_1.7.1_GENERIC.rdd/080925/ant:${PATH}
Try ant build. It should work without any error.
"I agreed with full path issue for the above issue, getting the same exception while folder has access problem"
I have faced the same exception in Macbook. Checked all the configurations JAVA_HOME, ANT_HOME and org.apache.tools.ant.launch.Launcher file in Ant related jars. Finally, found the issue, due to an access problem of the apache-ant folder. I have no admin access, so I moved my setup to the desktop.
$ make vcffilterjs : Compiles OK, with any of these "Linux OS´s" :
Debian 8 Jessie, CentOS 7, Fedora 23, Ubuntu 15.10, PCLinuxOS 2015.
No "ANT_HOME" or "JAVA_HOME" settings required, by using the default installed 'ant' and openjdk.
? Which "Linux OS" are you using ?
antjvarkit
I get an error on Core.NATIVE_LIBRARY_NAME like so:
Stacktrace:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
NATIVE_LIBRARY_NAME cannot be resolved or is not a field
at MyVideoCap.main(MyVideoCap.java:7)
I had settled the NativLibrary path at the following location.
/home/.../OpenCV/opencv-2.4.5/build/lib
I had followed the instruction on https://www.openshift.com/blogs/day-12-opencv-face-detection-for-java-developers but it doesn't creates any opencv2.4.9.jar file I am working on ubuntu 12 and eclipse with opencv api suppoert.
so help me if you can to generating and building the jar file in the build directory in ubuntu. thanks in advance...
Here I found the full Installing progress of the OpenCV...
# install basic development environment
sudo apt-get install build-essential cmake pkg-config
# install opencv dependencies. ubuntu 13.04 ships with opencv which is close enough to 2.4.6 to pull in most of the needed dependencies.
sudo apt-get build-dep libopencv-dev
# additional dependencies for java support
sudo apt-get install default-jdk ant
# compile opencv
tar xzvf opencv-2.4.6.1.tar.gz
cd opencv-2.4.6.1
mkdir build; cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON ..
make
sudo make install
And in last don't forget to set Native library path to the
/home/.../opencv-2.4.6.1/build/lib
Thats it...
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
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.