Property "Value" is already defined. How resolve from ANT - jaxb

I am using ANT build.xml to generate java proxy class. There i am getting below error.
"[wsimport] [ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict."
How to perform external binding through ANT build.xml.

Use xjc ANT task
write a bindings (.xjb) to define the appropriate jaxb:property
add -b argument to xjc execution task in ANT.
<arg value="-b"/>
<arg value="bindings.xjb"/>

Related

Building Nuxeo source code, dart issue

I am trying to build nuxeo source code & noticing below build issue. I noticed similar reported issue here. Has anyone faced similar issue?
Build error:
[exec] Transform Dart2JS on nuxeo_api_playground|web/index.web_components.bootstrap.dart threw error: type 'PrefixElementX' is not a subtype of type 'MemberEntity' in type cast where
An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /Users/kalava/Documents/Work/DAM/NuxeoOpenSource/nuxeo/addons/nuxeo-api-playground/src/main/dart/build.xml:9: exec returned: 65
[ERROR] around Ant part ...... # 4:278 in /Users/kalava/Documents/Work/DAM/NuxeoOpenSource/nuxeo/addons/nuxeo-api-playground/target/antrun/build-main.xml
Do you have the proper Dart version, as documented at https://doc.nuxeo.com/corg/installing-dart-and-related-tools/? Currently Nuxeo build requires Dart 1.23.x.

Can't run java prorgram with "java" command directly

I have compiled the java codes with
razrlele#OVO:~/workspace/javastudy/src$ javac Helloworld.java
and it turns out no errors or warnings
then I run the program with
razrlele#OVO:~/workspace/javastudy/src$ java Helloworld
it returns this
Error: Could not find or load main class Helloworld
I have to input like this
razrlele#OVO:~/workspace/javastudy/src$ java -cp ./ Helloworld
so that the program will run correctlly.
I am confused about why the "java" command doesn't work.
Here is my /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_11"
CLASSPATH=/usr/lib/jvm/jdk1.8.0_11
JAVA_HOME=/usr/lib/jvm/jdk1.8.0_11
Java will attempt to use your classpath to locate the class files. Since your classpath is set to /usr/lib/jvm/jdk1.8.0_11, that's where it looks.
By overriding the classpath with -cp ./, you tell it to look in the current directory for its class files.
There are a number of ways to fix this, including changing your classpath environment variable to include . or other localised paths as needed. I tend to prefer just setting up an alias (in my .bashrc for example) so regular Java programs aren't affected, something like (from memory):
alias jhere="java -cp $CLASSPATH:."
then I can just use:
jhere HelloWorld
to test my snippets.
Because . isn't in your CLASSPATH, first
export CLASSPATH="/usr/lib/jvm/jdk1.8.0_11:."
then
javac Helloworld.java
java Helloworld
It's also possible to use -cp (which is short for -classpath) with java at the command line, if you run java -h you will see
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.

Cygwin : error: package net.jradius.packet.attribute does not exist

This doesn't appear to be the usual CLASSPATH issue, but maybe something specific to cygwin.
The following illustrates the issue.
import net.jradius.packet.attribute.AttributeFactory;
public class Test{
static int x = 100;
}
When compiling the following error appears.
$ javac Test.java
Test.java:1: error: package net.jradius.packet.attribute does not exist
import net.jradius.packet.attribute.AttributeFactory;
^
1 error
The file jradius-core-1.1.4.jar is in the CLASSPATH.
When using the command line within Windows it works. Here is the classpath.
set CLASSPATH=c:\Temp\jradius-core-1.1.4.jar
When using cygwin it produces the error. Here is the classpath.
export CLASSPATH=/cygdrive/c/Temp/jradius-core-1.1.4.jar
The location is valid via cygwin as the following shows it is recognized.
ls $CLASSPATH
/cygdrive/c/Temp/jradius-core-1.1.4.jar
The same JDK is used for both scenarios.
Any idea why it may be failing via cygwin???
You are using JDK built for windows, so the environment is for windows.
That's being said, you should be provide windows-style path to javac.
cygpath is what you are looking for here.
Try:
javac Test.java -cp `cygpath.exe -w /cygdrive/c/Temp/jradius-core-1.1.4.jar`
cygpath -w means print in windows style.
Or just put the jar file in the same directory of the java file, and in cygwin:
javac Test.java -cp jradius-core-1.1.4.jar
Refer from this
Added the JAR files into the directory and changed the classpath to include '*' and that appears to have worked.

java.lang.IllegalArgumentException: Not a valid class name: ANDROID NDK javah

Im learning to code Android in NDK on WINDOWS Eclipse.... been following a Tutorial Book by Sylvain Ratabouil. So im in Run | External Tools | External Tools Configurations…
creating a new program configuration.
Name: MyProject javah
Location : ${env_var:JAVA_HOME}\bin\javah.exe
Working directory: ${workspace_loc:/MyProject/bin}
The problem comes In arguments...
when i try
Arguments: –d ${workspace_loc:/MyProject/jni} com.myproject.MyActivity
as it says in the book
i get when i click run
Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: –d
when i try ${workspace_loc:/MyProject/jni} com.myproject.MyActivity}
i get
Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: C:\Paul\Workspace\MyProject\jni
UPDATE:
i put -classpath first and it's running but can not find the class file for com.myproject
after further research....
i did it.
i set arguments to
-d ${workspace_loc:/MyProject/jni} -classpath C:\Paul\android-sdk-windows\platforms\android-17\android.jar;${workspace_loc:/MyProject/bin/classes} com.myproject.MainActivity
I also spend some long time on this problem when working with the the mentioned book about Android NDK.
Please note the following:
The java classname is NOT written in { }, just write something like com.myproject.MyActivity
The -classpath parameter can receive several paths devided by semicolon.
In my case this parameters worked:
Location:
${env_var:JAVA_HOME}\bin\javah.exe
Working Directory:
${workspace_loc:/myproject/bin}
Arguments:
-d ${workspace_loc:/myproject/jni} -classpath ${workspace_loc:/myproject/bin/classes};"C:\Eclipse\sdk\platforms\android-18\android.jar" com.myproject.MyActivity
(BTW.: The correct Adroid.jar file is referenced inside the Eclipse project.)
Me also facing the same problem tonight, i found a less tedious way as following...
as "Location" set the javah from your system
as "Working directory" set the project's bin/classes directory (${workspace_loc:/HelloWorld/bin/classes})
as "Argument" set the jni folder as the output directory and point out the class on which you want to run the javah (-d "${workspace_loc:/HelloWorld/jni}" com.example.helloworld.MainActivity)
NB :: Dont forget the double qoute (") around the output in the third step ("${workspace_loc:/HelloWorld/jni}")
A full picture is also attached following
well in case ...
1-> Goto ( cd C:\Program Files\Java\jdk1.7.0_60\bin)
2-> C:\Program Files\Java\jdk1.7.0_60\bin>javah -jni -classpath
F:\Android_OpenGLES\FibonacciNative\bin\classes
-d F:\Android_OpenGLES\FibonacciNative\jni\ com.example.fibonaccinative.FibLib
without creating/using environment variable ...
Following I tried successfully
javah com.sense.kios.Calculation
Note: Include package name.
In case if javah not found as an command and you getting
The program 'javah' can be found in the following packages:
* gcj-4.6-jdk
* gcj-4.7-jdk
* openjdk-7-jdk
* openjdk-6-jdk
Try: sudo apt-get install <selected package>
use direct path of jdk path, in my case it's /usr/lib/jvm/jdk1.8.0/bin/javah.
YES THAT'S CORRECT
more abstract would be
-d ${workspace_loc:/MyProject/jni} -classpath ${env_var:ANDROID_SDK_HOME}\platforms\android-16\android.jar;${workspace_loc:/MyProject/bin/classes} com.myproject.MyActivity

Ant LibusbJava compile error: "jni.h: No such file"...fixed, now a memset error

There appears to be a Ant / jni.h problem (for my setup) with LibusbJava. I get the following error when setting up LibusbJava by running
ant linux
in CentOS 6.3 as root (quick and dirty test, thanks for those concerned about user level =0). I will redo with proper restrictions as shown on a libusbjava reference after reflection when first install works. LibusbJava, is a Java wrapper for the libusb library.
The output starts out like this:
[root#somebox LibusbJava]# ant linux -lib $JAVA_HOME/include -lib $JAVA_HOME/include/linux
Buildfile: build.xml
clean:
Build LibusbJava Test Linux:
Build LibusbJava Test:
[echo] Building Library for unit tests:
[exec] /.../libusbjava/trunk/LibusbJava/LibusbJava.cpp:27:17: error: jni.h: No such file or directory
[exec] /.../libusbjava/trunk/LibusbJava/LibusbJava.cpp:34:26: error: test/CuTest.h: No such file or directory
`...`
as it was not set on my system. It appears that jni.h is a header called by C++ code, which I had to add to the LibusbJava.cpp file. This is the new include, /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/include/jni.h. I then get an error with jni.h not being able to fine jni_md.h which is an include in jni.h #include "jni_md.h".
Clearly this is not the right approach, so perhaps I need a correct Ant reference, but I cannot seem to do it with a -lib switch. Besides, this just creates thousands of jni.h file errors during the Ant build attempt.
How can I fix this problem?
Notes: I've set$JAVA_HOME up like JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64 and javac and java work fine.
New discovery... after helpful questions which guided me, I am much closer to successful compilation.
When I install LibusbJava and manually install all the library references in build.xml there is still an error compiling the LibusbJava based on a memset error. I see memset patches for libusb that appeared in 2007 and it's unclear how to use or if they relate. Investigating... Hints, comments and questions welcome. My most sincere thanks for the help thus far.
[exec] /.../libu/libusbjava/trunk/LibusbJava/objects/Usb_Device.cpp: In function ‘void Usb_Device_disconnect(JNIEnv*)’:
[exec] /.../libu/libusbjava/trunk/LibusbJava/objects/Usb_Device.cpp:88: error: ‘memset’ was not declared in this scope
[antcall] Exiting /.../libu/libusbjava/trunk/LibusbJava/build.xml.
BUILD FAILED
but I find no referece to an include string.h or cstring. The header of Usb_Device.cpp mentions it is a C++ Stub for the java class of a java class ch.ntb.inf.libusbJava.Usb_Device. which only has this include #include "Usb_Device.h" which also does not appear to have a string include. Perhaps just insertion of#include`?

Resources