Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library - dalvik

When I clean my project I get the following error:
[2011-10-05 13:47:53 - The Basics] Dx
trouble processing "java/nio/CharBuffer.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.
However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.
If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.
If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.
If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.
[2011-10-05 13:47:53 - The Basics] Dx 1 error; aborting
[2011-10-05 13:47:53 - The Basics] Conversion to Dalvik format failed with error 1

I had this problem. I use Maven to build my android projects. My problem was caused by one of my dependencies depending on the android jars. I updated my pom to exclude android from that dependency and that solved it for me.
<dependency>
<groupId>org.reassembler</groupId>
<artifactId>synth-android</artifactId>
<version>2.5.8</version>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
<exclusion>
<artifactId>android</artifactId>
<groupId>android</groupId>
</exclusion>
</exclusions>
</dependency>
Hope this helps someone, it took me a while to figure out what was going on.

For the benefit of anyone who may have stumbled upon this, this problem can be caused by inclusion of an older library such as android.jar. Removing the .jar file from your buildpath will allow you to compile. Otherwise, you can use the "jarjar" mentioned in the error message to move the .jar file to another package.

Your IDE is misconfigured. Make sure that your scripts or IDE isn't passing rt.jar or android.jar to dx.

In Android Studio, I had included java and javax jar files in my lib folder and there were dependencies related to them (in build.gradle at the app level). I commented them out.
//compile files('libs/ K java-rt-jar-stubs-1.5.0.jar')
//compile 'javax.annotation:jsr250-api:1.0'
//compile files('libs/javax. annotation.jar')
Then i went to the Project View and deleted the jar files. There were some legacy instances of java.awt.geom which I had to purge, but rebuilt project and then i was fine.

Related

Looking for solution for exporting data to Excel with Vaadin

We are looking for solution to export the data to excel in Vaadin application.
I have downloaded Vaadin excel exporter from GitHub https://github.com/bonprix/vaadin-excel-exporter which sounds to be a very useful utility but I am getting the error below when I am compiling vaadin-excel-exporter-demo project.
<vaadin.version>8.0.6</vaadin.version>
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project vaadin-excel-exporter-demo: Compilation failure: Compilation failure:
[ERROR] /C:/Java/Vaadin/VaadinProjetcs/vaadin-excel-exporter-master/vaadin-excel-exporter-master/vaadin-excel-exporter-demo/src/main/java/org/vaadin/addons/excelexporter/demo/DemoUI.java:[12,61] package org.vaadin.addons.excelexporter.configuration.builder does not exist
I've tried mvn clean and also delete the full .m2/repository local repository 
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)
After searching on different forums it looks like maybe this add-on is missing from Maven repo. I have tried version 2.1 and LATEST.
<artifactId>vaadin-excel-exporter</artifactId>
<packaging>jar</packaging>
<!--version>2.1-SNAPSHOT</version-->
<version>LATEST</version>
<name>Excel Exporter</name>
So I have two questions.
Has anybody had the same problem wih this tool and/or maybe can explain what i am doing wrong.
If this tool is not maybe available anymore can anyone please share the tool which I can use to export the grid data to Excel. I am new with Vaadin so providing the code examples will be highly appreciated
Thanks
Alex
If you look at the add-on through Vaadin directory, you'll find the necessary additions to your pom.xml in the Maven section of the sidebar. In this case, like Erik said in the comments, you are likely missing
<repository>
<id>vaadin-addons</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
</repository>
The directory page also includes code samples for using the component after you get the dependencies fixed, as well as other information about the add-on. I haven't tested whether the demo within GitHub works, but the add-on itself should be usable in your project regardless. The newest version published through the directory is 2.0.
If you want to compile the add-on locally rather than use it through the add-on repository, you need to first successfully compile the add-on module, and then use the exact version configured in the pom.xml. Currently the master branch seems to be using <version>2.1-SNAPSHOT</version>.

Some issues with using DeepLearning4J dlls

I am working with DeepLearning4J working with the 1.0.0-beta7 release. I am getting two errors at run time.
jnind4jcpu.dll unsupported jni version 0xffffffff
no nd4jcpu in java.library.path
I setup a path to the to a folder where I have a few other dlls for this effort. I am using java jvm 1.8.
So what version of the jvm should I use for question #1 and where in the dn4j maven project can I find the second one? I tried the uber jar for nd4j and still the same errors.
Thanks for any help!
Your issue doesn't have anything to do with the java version. Make sure you're not mixing versions of dl4j.
You don't really need to dig in to the internals or deal with any of the manual workarounds that you normally see in the jni based libraries.
All you need to do is include nd4j-native-platform in your classpath:
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>1.0.0-beta7</version>
</dependency>
Nd4j/dl4j is based on javacpp and takes care of all of that for you.
To give you even more targeted advice, I would have to know more about your environment (ideally reproducible on github)

is possible remove Jhipster Dependencies in back? why is necessary?

is possible remove Jhipster Dependencies in back? why is necessary or recommended???
IF I REMOVE OF POM.XML appears different compilation errors.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.github.jhipster</groupId>
<artifactId>jhipster-dependencies</artifactId>
<version>${jhipster-dependencies.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- jhipster-needle-maven-add-dependency-management -->
</dependencies>
</dependencyManagement>
Is it possible?
Yes but you have to import all the dependencies yourself although nothing very difficult because most of them are already provided as Spring Boot starters. Looking at effective pom with mvnw help:effective-pom could help.
Then you must import maven plugins configuration.
Finally, your project will still depend on jhipster-framework library unless you extract only the classes your project needs.
Is it recommended?
For long term, managing yourself your dependencies is a good thing because major libraries like Spring Boot, Hibernate, ... support old releases for quite a long time while JHipster team supports only current major release (currently 7.x) which usually means one year.
At the beginning of your project, you will probably want to be able to follow JHipster updates. Modifying the pom.xml will make updating generated code more difficult.
Once you have written much manual code, your project is probably already too difficult to update, so cutting the dependency with JHipster will be harmless.
I found it harder to remove dependency from JHipster frontend than from backend because for instance ng-jhipster has some dependencies on Bootstrap that require some effort to remove.

hadoop aws versions compatibility

Is there any reference as to what sets of versions are compatible between aws java sdk, hadoop, hadoop-aws bundle, hive, spark?
For example, I know Spark is not compatible with hive versions above Hive 2.1.1
You cannot drop in a later version of the AWS SDK from what which hadoop-aws was built with and expect the s3a connector to work. Ever. That is now written down quite clearly in the S3A troubleshooting docs
Whatever problem you have, changing the AWS SDK version will not fix things, only change the stack traces you see.
This may seem frustrating, given the rate at which the AWS team push out a new SDK, but you have to understand that (a) the API often changes incompatibly between versions (as you have seen), and (b) every release introduces/moves bugs which end up causing problems.
Here is the 3.x timeline of things which broke on updates of the AWS SDK.
Move 1.11.86 and some tests hang under load.
Fix: move to 1.11.134 leading to logs are full of AWS telling us off for deliberatly calling abort() on a read.
Fix: move to 1.11.199 leading to logs full of stack traces.
Fix: move to 1.11.271 and shaded JAR pulls in netty unshaded.
Every upgrade of the AWS SDK JAR causes a problem, somewhere. Sometimes an edit to the code and recompile, most commonly: logs filling up with false-alarm messages, dependency problems, threading quirks, etc. Things which can take time to surface.
what you see when you get a hadoop release is not just an aws-sdk JAR which it was compiled against, you get a hadoop-aws JAR which contains the workarounds and fixes for whatever problems that release has introduced and which were identified in the minimum of 4 weeks of testing before the hadoop release ships.
Which is why, no, you shouldn't be changing JARs unless you plan to do a complete end-to-end retest of the s3a client code, including load tests. You are encouraged to do that, the hadoop project always welcomes more testing of our pre-release code, with the Hadoop 3.1 binaries ready to play with. But trying to do it yourself by changing JARs? Sadly, an isolated exercise in pain.
In Hadoop documentation, it is stated that by adding hadoop-aws JAR to the build dependencies; it will pull in a compatible aws-sdk JAR.
So, I created a dummy Maven project with these dependencies to download the compatible versions
<properties>
<!-- Your exact Hadoop version here-->
<hadoop.version>3.3.1</hadoop.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-aws</artifactId>
<version>${hadoop.version}</version>
</dependency>
</dependencies>
Then, I checked my dependencies versions, used it in my project and it worked.

Semantic Role Labeler used in Java/vb.net

I want to use Semantic Role Labeler tool from Illinois in my project.
I've seen the online demo of the SRL tool. To use that tool, the website suggests downloading the Curator. I have downloaded this Curator file. But how do I use the Curator file in Java code or VB.NET code? Can anybody help me?
And I also want to mention a few tips about Curator. The reason that you will need a Curator is that the SRL package as a complicated software now need a few external dependencies, for example, illinois Part of Speech, Shallow parsing, and currently Charniak parser. And Curator is a tool we used to manage those dependencies.
However, the curator will also installed a few other dependency that you may not need for SRL, for example, Named entity tagger, and Wikifier. Those component tends to consume plenty of RAM (for example, the two listed here will need 10GB), so you may want to turn them oof, by comment out the line in $CURATOR_HOME/dist/startServer.sh which should be self-explained.
Once you have Curator up and running, you can call it from you program using a curator-client package, the easiest way to do this in JAVA is using maven:
First add the CCG maven repo to your project:
<repositories>
<repository>
<id>CogcompSoftware</id>
<name>CogcompSoftware</name>
<url>http://cogcomp.cs.illinois.edu/m2repo/</url>
</repository>
</repositories>
And then add the following dependencies:
<dependency>
<groupId>edu.illinois.cs.cogcomp</groupId>
<artifactId>curator-interfaces</artifactId>
<version>0.7</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.8.0</version>
</dependency>
Since the API and data structure are defined in Thrift, so you may use them in other language by generating the curator package via thrift, (However, VB.NET is not supported by Thrift as Daniel pointed out :) ) Watch for the CCG website if you are interested, we are writing a tutorial about how to do this, which should be public available very soon.
And after you have the above dependency, you should be able to follow our walkthrough on
http://cogcomp.cs.illinois.edu/curator/CuratorDemo.html
Let me know if you have any problem.
You are asking several questions.
The standalone SRL is under development and it will be release soon.
The best way to access to SRL is currently installing Curator, which is explained here:
http://cogcomp.cs.illinois.edu/trac/curator.php
I don't think you can use Curator in VB.Net. Since it is designed to the languages supposed by Apache Thrift :
http://thrift.apache.org/about
After installing it you can easily access it in Java. Here is a Walkthrough:
http://cogcomp.cs.illinois.edu/curator/CuratorDemo.html
you can use SENNA which is a free NLP tools developed in ASNI c and could be run in visual studion.net
http://ronan.collobert.com/senna/
it can outputs: part-of-speech (POS) tags, chunking (CHK), name entity recognition (NER), semantic role labeling (SRL) and syntactic parsing (PSG).

Resources