I am facing an issue with Unable to execute dex: method ID not in [0, 0xffff]: 65536), so I found this post that can help me resolve this error. But as you will see in that post that it needed ant installation. So I started learning the docs for ANT and completed installation of ANT.
But now I cannot fire ant -release command, although I was able to fire ant -debug. The complete log of ant -help and ant -version has been attached to this if it could help anyone. You can see in here that is doesn't have ant -release command:
D:\xxxxxandroid\NilayNew\xxxxxx>ant -help
ant [options] [target [target2 [target3] ...]]
Options:
-help, -h print this message
-projecthelp, -p print project help information
-version print the version information and exit
-diagnostics print information that might be helpful to
diagnose or report problems.
-quiet, -q be extra quiet
-silent, -S print nothing but task outputs and build failures
-verbose, -v be extra verbose
-debug, -d print debugging information
-emacs, -e produce logging information without adornments
-lib <path> specifies a path to search for jars and classes
-logfile <file> use given file for log
-l <file> ''
-logger <classname> the class which is to perform logging
-listener <classname> add an instance of class as a project listener
-noinput do not allow interactive input
-buildfile <file> use given buildfile
-file <file> ''
-f <file> ''
-D<property>=<value> use value for given property
-keep-going, -k execute all targets that do not depend
on failed target(s)
-propertyfile <name> load all properties from file with -D
properties taking precedence
-inputhandler <class> the class which will handle input requests
-find <file> (s)earch for buildfile towards the root of
-s <file> the filesystem and use it
-nice number A niceness value for the main thread:
1 (lowest) to 10 (highest); 5 is the default
-nouserlib Run ant without using the jar files from
${user.home}/.ant/lib
-noclasspath Run ant without using CLASSPATH
-autoproxy Java1.5+: use the OS proxy settings
-main <class> override Ant's normal entry point
D:\xxxxxandroid\NilayNew\xxxxxx>ant -version
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
Can anyone suggest me what went wrong or what is it that I am missing ?
Thanks in advance
ant -debug, ant -help and ant -version are out-of-the-box funcionality of ANT.
Please read ANT documentation from: http://ant.apache.org/manual/index.html
ANT by defalut use build.xml file that contain configuration (what 'methods'/procedures are invoked). ANT is looking for '-release' target in that file and if doesn't exist, it crash...
Check build.xml looking for '-release' target
Recheck what command you need to execute
Why you want to launch ant -release?
Related
I'm following this tutorial which tries to minimize the JVM memory footprint by building a minimal JVM.
When I'm running jdeps -s myjar.jar I'm getting:
myjar.jar -> java.base
myjar.jar -> java.logging
myjar.jar -> not found
In the tutorial he solves this by running another command.
jdeps -cp 'lib/*' -recursive -s myjar.jar
I tried this but I'm getting the same result.
How to run it correctly?
For a Maven project, you can do it like this:
Run mvn dependency:build-classpath
Copy the output of the maven-dependency-plugin (the line after "Dependencies classpath:")
Run jdeps -cp <paste output here> -s -recursive myjar.jar
It is due to Bug in Jdeps and has been the same since JDK 8 at least.
You can see the actual Path parser checks if the -cp/-classpath argument list contains "dir/.*" format and not "dir/*" format as advertised by the docs, examples and the API's javadoc.
JdepsConfiguration.java:599
I'm trying to package two symlinks to corresponding jars provided by external dep1.rpm and dep2.rpm. These are declared as dependencies in my-app-extra.spec:
Requires: dep1
Requires: dep2
I have my %install symlinking their jars (%dep1jar, %dep2jar):
%install
%{__install} -d -m 0755 $RPM_BUILD_ROOT%{_javadir}
%{__install} -d -m 0755 $RPM_BUILD_ROOT%{_javadir}/%{my_app}
pushd $RPM_BUILD_ROOT%{_javadir}/%{my_app}
for jar in %dep1jar %dep2jar
do
ln -sf ../"${jar}" "${jar}"
done
popd
but the rpmbuild fails with:
ERROR: link target doesn't exist (neither in build root nor in installed system):
/usr/share/java/my-app/dep1.jar -> /usr/share/java/dep1.jar
Add the package providing the target to neededforbuild and Requires
// same error for dep2.jar
error: Bad exit status from /var/tmp/rpm-tmp.31253 (%install)
Is there any way to circumvent this rpmbuild check?
Background
I have a java application that (optionally) requires two external libraries to provide extended functionality. To install these libraries, I have created dep1.rpm and dep2.rpm that store the jars under %_datadir/java and an additional my-app-extra rpm that should symlink those under %_datadir/java/my-app (following some apparently established java-packaging conventions under linux).
But I'm failing to find how to force rpmbuild to build this rpm without declaring the external libraries as BuidRequires and having them installed first.
What I want
This is in summary what I'm after (simplified, as the complete solution involves versioning):
/usr/share/java/dep1.jar (from dep1.rpm)
/usr/share/java/dep2.jar (from dep2.rpm)
/usr/share/java/my-app/dep1.jar -> ../dep1.jar (from my-app-extended.rpm)
/usr/share/java/my-app/dep2.jar -> ../dep2.jar (from my-app-extended.rpm)
Note: I'm now exploring the possibilities of rpm subpackages, but I somehow expect this to be possible without subpackaging.
I could make it work 'touching' the targets and excluding them from the files. In my-app-extra.spec:
%install
%{__install} -d -m 0755 $RPM_BUILD_ROOT%{_javadir}
%{__install} -d -m 0755 $RPM_BUILD_ROOT%{_javadir}/%{my_app}
pushd $RPM_BUILD_ROOT%{_javadir}/%{my_app}
for jar in %{dep1jar} %{dep2jar}
do
# touch! rpmbuild aborts the build if symlink targets missing!
touch ../"${jar}"
ln -sf ../"${jar}" "${jar}"
done
popd
# more stuff ...
%files
# ...
# Exclude dummy (touched) files!
%exclude %{_javadir}/%{dep1jar}
%exclude %{_javadir}/%{dep2jar}
%{_javadir}/%{my_app}/%{dep1jar}
%{_javadir}/%{my_app}/%{dep2jar}
I'm trying to launch:
ant rpm
command where my build.xml at line #126 looks like:
<rpm specFile="whatever.spec" topDir="${basedir}/rpm" command="-bb" failOnError="true" />
I'm getting the error:
build.xml:126: Problem: failed to create task or type rpm
Cause: the class org.apache.tools.ant.taskdefs.optional.Rpm was not found.
This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
-/usr/share/ant/lib
-/export/home/myuser/.ant/lib
-a directory added on the command line with the -lib argument
I downloaded ant-nodeps-1.7.1.jar which contains:
jar tvf ant-nodeps-1.7.1.jar | grep Rpm
7171 Fri Jun 27 05:03:48 CEST 2008 org/apache/tools/ant/taskdefs/optional/Rpm.class
I placed this jar file to directory: /usr/share/ant/lib
ant-1.7.0.jar -> ../../java/ant-1.7.0.jar
ant.jar -> ../../java/ant.jar
ant-launcher-1.7.0.jar -> ../../java/ant-launcher-1.7.0.jar
ant-launcher.jar -> ../../java/ant-launcher.jar
ant-nodeps-1.7.1.jar
but still getting that build error.
I tried also with commands:
ant -lib /usr/share/ant/lib rpm
ant -lib /usr/share/ant/lib/ant-nodeps-1.7.1.jar rpm
ant -lib ant-nodeps-1.7.1.jar rpm
whithout succes, getting the same error.
What is missing, what I need to do ?
Thanks !
cd into your ANT_HOME directory and run ant -f fetch.xml -Ddest=system
This will download the optional ant dependencies you need to ant rpm.
This is from the ant install guide.
This is mostly a java question, and likely something I'm overlooking.
I've been trying to use osmdroid-packager (http://code.google.com/p/osmdroid/wiki/HowToUsePackager) to package map tiles for my android app, on Ubuntu Linux. I've been following the instructions on the site above, and have run into some issues.
I have in my current directory, osmdroid-android-3.0.8.jar, osmdroid-packager-3.0.8.jar, and slf4j-android-1.6.1-RCq.jar. I've setting the classpath, and attempting to run using the commands below gives me the error
'Could not find or load main class
org.osmdroid.mtp.OSMMapTilePackager'
I've also tried different variations of setting the classpath (setting classpath, CLASSPATH, to the jars, to the current directory, with -classpath) with the same result. The best I can come up with is that the class is not in the jar.
The commands I tried from the website above were:
set classpath='osmdroid-android-3.0.8.jar;osmdroid-packager-3.0.8.jar;slf4j-android-1.6.1-RC1.jar;sqlitejdbc-v056.jar'
java org.osmdroid.mtp.OSMMapTilePackager -u http://tile.openstreetmap.org/%d/%d/%d.png -t Mapnik -d haarlem.zip -zmax 18 -n 52.4244 -s 52.3388 -e 4.6746 -w 4.594
java -cp . org.osmdroid.mtp.OSMMapTilePackager
also gives the same error.
I haven't downloaded a copy of sqlitejdbc yet, but I'm pretty sure that's not the issue.
Use a 3.0.3 version to osmdroid-packager , osmdroid-packager for example
Use the same versions od libriries to this prompt command
set classpath=osmdroid-android-3.0.3.jar;osmdroid-packager-3.0.3.jar;slf4j-android-1.5.8.jar;sqlitejdbc-v056.jar
java org.andnav2.osm.mtp.OSMMapTilePackager -u http://tile.openstreetmap.org/%d/%d/%d.png -t Mapnik -d haarlem.zip -zmax 18 -n 52.4244 -s 52.3388 -e 4.6746 -w 4.5949
I want to check internal web pages, so I cannot use the W3C validation service directly. I managed to run the XHTML validator locally, however, I have some problems with the css-validator. I do not really want to setup Tomcat or Jigsaw in order to be able to run Java servlet, and the commandline option gives me an error message
Exception in thread "main" java.lang.NoClassDefFoundError:
org.w3c.tools.resources.ProtocolException at
org.w3c.css.css.CssValidator.main(CssValidator.java:164)
How can I validate local CSS on a Linux box?
That jar is runnable, but it needs some extra libraries.
Examine the MANIFEST.MF file:
$ unzip -p css-validator.jar META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.0
Created-By: 1.6.0_26-b03 (Sun Microsystems Inc.)
Main-Class: org.w3c.css.css.CssValidator
Class-Path: . lib/commons-collections-3.2.1.jar lib/commons-lang-2.6.j
ar lib/jigsaw.jar lib/tagsoup-1.2.jar lib/velocity-1.7.jar lib/xerces
Impl.jar lib/xml-apis.jar lib/htmlparser-1.3.1.jar
You need all the jars mentioned in Class-Path. You can download them from the maven repository using this script:
#!/bin/bash
set -e
mkdir -p lib
curl -LO http://www.w3.org/QA/Tools/css-validator/css-validator.jar
echo "\
http://repo1.maven.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
http://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
http://repo1.maven.org/maven2/org/w3c/jigsaw/jigsaw/2.2.6/jigsaw-2.2.6.jar jigsaw.jar
http://repo1.maven.org/maven2/org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar
http://repo1.maven.org/maven2/org/apache/velocity/velocity/1.7/velocity-1.7.jar
http://repo1.maven.org/maven2/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar xercesImpl.jar
http://repo1.maven.org/maven2/nu/validator/htmlparser/htmlparser/1.2.1/htmlparser-1.2.1.jar\
" | while read url shortname; do
if [ -z "$shortname" ]; then
shortname="${url##*/}"
fi
curl -L -o "lib/${shortname}" "${url}"
done
After doing that, it works:
$ java -jar css-validator.jar --output=soap12 file:badcss.html
{vextwarning=false, output=soap12, lang=en, warning=2, medium=all, profile=css3}
<?xml version='1.0' encoding="utf-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<m:cssvalidationresponse
env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
xmlns:m="http://www.w3.org/2005/07/css-validator">
<m:uri>file:badcss.html</m:uri>
<m:checkedby>http://jigsaw.w3.org/css-validator/</m:checkedby>
<m:csslevel>css3</m:csslevel>
<m:date>2013-03-12T06:40:09Z</m:date>
<m:validity>false</m:validity>
<m:result>
<m:errors xml:lang="en">
<m:errorcount>1</m:errorcount>
<m:errorlist>
<m:uri>file:badcss.html</m:uri>
<m:error>
<m:line>8</m:line>
<m:errortype>parse-error</m:errortype>
<m:context> h1 </m:context>
<m:errorsubtype>
exp
</m:errorsubtype>
<m:skippedstring>
100%
</m:skippedstring>
<m:message>
Property fnt-size doesn't exist :
</m:message>
</m:error>
</m:errorlist>
</m:errors>
<m:warnings xml:lang="en">
<m:warningcount>1</m:warningcount>
<m:warninglist>
<m:uri>file:badcss.html</m:uri>
<m:warning>
<m:line>5</m:line>
<m:level>0</m:level>
<m:message>You should add a 'type' attribute with a value of 'text/css' to the 'style' element</m:message>
</m:warning>
</m:warninglist>
</m:warnings>
</m:result>
</m:cssvalidationresponse>
</env:Body>
</env:Envelope>
You can invoke the W3C validator from the command line:
Command-Line use
Any computer with Java installed can
also run the validator from the
terminal/console as a commandline
tool. Download the css-validator.jar
jar archive (or build it with ant jar)
and run it as :
java -jar css-validator.jar http://www.w3.org/
Note : the css-validator.jar file must
be located at the exact same level as
the lib/ folder to work properly.
Update: To get it to work, I checked out the full distribution from CVS and ran ant using the included build.xml. It downloaded all dependencies except for servlet.jar. To deal with that, I downloaded the binary distribution of Tomcat 6 and extracted it. Then, I edited the build.xml for css-validator to reflect the location of servlet.lib:
<property name="servlet.lib"
value="E:/Downloads/apache-tomcat-6.0.20/lib/servlet-api.jar"/>
Then ran ant again. This produced the css-validator.jar file in the top level of the directory checked out from CVS with the lib subdirectory containing the other jars it depends on. Then, I was able to run the validator successfully:
C:\Temp\validator\2002\css-validator> java -jar css-validator.jar http://www.unur.com/
For the lazy, here's a script I wrote to do what Sinan suggests:
#!/bin/sh
# W3C CSS Validator Install Script --------------
# installs W3C CSS Validator
# requires: ant, wget, javac
# see: http://jigsaw.w3.org/css-validator/DOWNLOAD.html
# see: http://esw.w3.org/CssValidator
# see: http://thecodetrain.co.uk/2009/02/running-the-w3c-css-validator-locally-from-the-command-line/
# see: http://stackoverflow.com/a/3303298/357774
##wget "http://www.w3.org/QA/Tools/css-validator/css-validator.jar"
#sudo aptitude install -y ant # uncomment if you don't have ant
CVSROOT=:pserver:anonymous:anonymous#dev.w3.org:/sources/public cvs checkout 2002/css-validator
mkdir 2002/css-validator/lib
TOMCAT6_VERSION='6.0.45'
wget "http://www.apache.org/dist/tomcat/tomcat-6/v$TOMCAT6_VERSION/bin/apache-tomcat-$TOMCAT6_VERSION.tar.gz"
tar xvf apache-tomcat-$TOMCAT6_VERSION.tar.gz
mv apache-tomcat-$TOMCAT6_VERSION/lib/servlet-api.jar 2002/css-validator/lib/servlet.jar
rm -rf apache-tomcat-$TOMCAT6_VERSION apache-tomcat-$TOMCAT6_VERSION.tar.gz
cd 2002/css-validator
ant jar
# usage example: java -jar css-validator.jar "http://csszengarden.com/"
That should work, at least until the next software dependency update breaks the ant build script (feel free to parameterize versions).
Hope this helps!
You can now use the new Linux command line tool htmlval for checking HTML and CSS. It should definitely work for validating local CSS on a Linux box.
Note: I'm the developer.