html5 checker compilation - java

I would like to use html5 validator from LiipFunctionalTestBundle in my Symfony2 project.
So, I followed instructions on bundle's github page, but I got this error during python build:
IOError: [Errno 2] No such file or directory: './syntax/relaxng/datatype/java/dist/html5-datatypes.jar'
indeed, there is a "dist" folder under that path, but it's empty (no files inside).
I also tried to download file from daisy-pipeline, but it's deleted after running python build again
I'm using Java 1.7.0_04 on Ubuntu x64

As noted above:
You need to install JDK, not only JRE. That is because you need java compiler.

Related

Creating BSS files from CSS in JavaFX 9 [duplicate]

I have Ubuntu Linux system with Sun JDE 9.0.1 and I need to convert some of Fx's CSS files to binary form from console.
But when I execute the command:
javapackager -createbss -outdir . -srcdir .
I got an error:
Error: jfxrt.jar needs to be on classpath for -createbss and for
-createJar without -nocss2bin
My JDK is properly installed. I have all necessary modules (including FX).
Any ideas how I can avoid a stupid bug and I make the packager to do it's job?
If I run javapackager from "/usr/lib/jvm/java-9-oracle/jmods" directory it completes without error. So right now I am using an ugly fix, search the modules directory, make it current, run packager from there. But that's damn ugly.
javapackager doesn't accept any other parameters but outdir, srcdir and srcfiles so I can't force loading or looking path for the jfx module. But may there is some trick with environment variables or something that can make the fix less ugly?
P.S. Running from jmod directory or removing "-srcdir" from the parameters eliminates the error, but the packager doesn't generate any output files (even if I specify input files with "-srcfiles"). Seems as javapackager is completely broken in createbss mode. Does anyone use it with Java 9?
I've checked the sources - javapackager from JDK 9.0.1 is totally broken! Use executable file from Java 8. I filled out a bug report to Oracle and all of a sudden they were very surprised (nobody noticed that one of the basic function ot a core tool is broken yet?!).
TEMPORARY SOLUTION: Use the javapackaged tool from JDK 1.8. All you need is the executable itself and you can put at any place. I put it right into my project tree (under "tools" directory) and call from a building script. WARNING! Use this replaced executable for "createbss" ONLY! Use the regular one for all other things!

Set up OpenNLP: Text Detection using the Vision java API

Set up OpenNLP
Download Tokenizer data and save it to this directory.
wget http://opennlp.sourceforge.net/models-1.5/en-token.bin
This is what Google asks me at here
I got no clue what OpenNLP is so I google it.
This is what Apache says on their Setup OpenNLP page:
If you have an IDE installed such as NetBeans or Eclipse installed, it
will make your development easier. However, follow on for the brave.
I got Intellij NetBeans, how do I set it up?
When building with maven in Intellij and attempting to run this sample, this is the error that I get:
java.io.FileNotFoundException: en-token.bin (The system cannot find the file specified)
When I try to continue with Google doc I fail in this line:
java -cp target/vision-text-1.0-SNAPSHOT-jar-with-dependencies.jar com.google.cloud.vision.samples.text.TextApp data/
With an error:
Error: Could not find or load main class com.google.cloud.vision.samples.text.TextApp
It looks like all you need from OpenNLP is that Tokeniser .bin file - this is just a binary file that the library uses to tokeise text (e.g. split sentences into words). It would appear like there is nothing else you need from that library - If you look in the google vision pom file(https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/vision/text/pom.xml) you will see they have a dependency on the OpenNLP JAR, so here you are just grabbing the pre-trained resource for that library.
Assuming you have cloned that GitHub repo, and have successfuly run the maven command they mention:
mvn clean compile assembly:single
Then that downloaded file (en-token.bin) should be copied to the root of the project directory (the same location as the pom.xml and where you are running the java command).
If the setup is like that then it should work ok.

Setting javacc to work with command prompt

I've been trying to set up javacc but am having problems. When I type javacc adder.jj (in the directory where adder.jj is) I am getting "'javacc' is not recognized as an internal or external command, operable program or batch file".
To my understanding I have to go to environmental variables, TEMP and change PATH to have C:\javacc-6.0\bin; added to the start. (I extracted the javacc zip to C:). I have tried this and restarted my computer with no luck. I also tried adding C:\javacc-6.0\bin\lib but again no luck. I did this when I installed java to get cmd to recognise javac and it worked!
This is probably trivial but I just can't get it to work!
Thank you
Henry
In the version 6.0 the bin directory is missing the scripts which run javacc. That is why you are getting the error from the windows command prompt.
What you have is a jar file javacc.jar located in the lib directory. All you need is to add that jar file to your classpath and run the java.exe and pass the main class which runs javacc, the later happens to be named javacc too, so to run javacc just proceed like this:
cmd> java -cp C:\javacc-6.0\bin\lib\javacc.jar javacc
In the latest version they seem to have forgotten to add the scripts in the bin folder of the package. You can download version 5.0, it containes all the script files you need, among others a file with the name javacc.bat, this is the one the window commad prompt is looking for and not finding in your case.
Of course, you can just copy those scripts from the 5.0 version to the bin directory of the 6.0 version, they will also work. and since you already have set the path to contain C:\javacc-6.0\bin then you can run it like you have tried before, without closing the command prompt window or even restarting your whole computer!
Edit - new links
The links above are unfortunately no longer valid, luckily the content has been moved to github. here the new links:
Project url: https://javacc.org/
Project url on github: https://javacc.github.io/javacc/
Earlier versions: https://github.com/javacc/javacc/branches/
Solution
Download version 5.0, copy the files that come in the bin folder, except the lib folder (they are .bat files)
Paste those files in the same location, but in version 6.0 and resolved issue.
The error is that they did not add the executables in the bin folder.
open cmd
cd to the directory where the javacc (calculator_2.jj) file loacted
type in the cmd java -cp D:\S2018\CS661\javacc-6.0\javacc-6.0\bin\lib\javacc.jar javacc calculator_2.jj

matlab javaaddpath not working anymore (with jar built with jdk 1.7)

I'm using an external jar (developped by me) into my matlab projet (developped by me) with javaaddpath command.
I have updated my programming environnement from Matlab r2011a to r2012b, jdk from 1.6.0_29 to 1.7.0_09 and windows from XP to Seven.
Firstly I have not recompiled my jar file, and my whole project is still working (running without bug).
But now, I'm trying to recompile my jar file. I had some problem with that, but it solved (see: javac #<opiton_file> and encoding). But now that my jar tool is rebuilt, I can't use it into matlab... Matlab display the error:
Undefined variable "optimizer" or function "optimizer.Gui".
where optimizer is a package (ie a directory inside the jar file, directory which contain a Gui class).
To summarize, I'm using the code (the last line must popup a JFrame) :
javaaddpath('the full path of my jar file.jar');
optimizer.Gui;
Without updating the compiled version of the jar file, it's working. With the new version (same source code), matlab output the error.
I have a Main class (containing a main function) at the root of the jar file and a manitifest specifying this Main class as the main class. This Main class make some test, to ensure all the functionnalities into the jar file is working. So I can run java -jar my_jar_file.jar and see that all test are OK (one of the test displayed my optimizer.Gui).
Is there an incompatibility of the javac version and matlab? Of is it because I had some trouble with file encoding?...
Ok, I've re-installed the JDK 1.6.0_37 (the last avaible 1.6 version).
I've used my build tool (create_jar.bat), by just forcing the path to this old jdk.
And it's working like a charm under Matlab r2012b!
--> Matlab r2012b is not compatible with jar file built with the jdk 1.7.
(Thank you Matworks to not prevent from this).
That hasen't anything to do with MATLAB. Its a general JAVA design limitation. You cant use classes compiled for JRE7 in JRE6.
Since MATLAB used JRE6 you can't use JAVA 7 classes due the limitation from the JAVA side.

Missing ant-javamail.jar file on Macintosh

I've been running the built-in Ant from the command line on a Macintosh (10.5.5) and have run into some trouble with the Mail task. Running the Mail task produces the following message:
[mail] Failed to initialise MIME mail: org.apache.tools.ant.taskdefs.email.MimeMailer
This is most likely due to a missing ant-javamail.jar file in the /usr/share/ant/lib directory. I see a "ant-javamail-1.7.0.pom" file in this directory but not the appropriate jar file. Anyone know why this jar file might be missing and what the best way to resolve the problem is?
Here's what I ended up doing to resolve the problem:
Downloaded the latest version of Ant from http://ant.apache.org/
The "built-in" Ant is installed in /usr/share/ant; I didn't want to overwrite that version so I extracted the new, full version into /usr/local/share/apache-ant-1.7.1/
As npellow points out, the the Mac doesn't include mail.jar or activation.jar -- these files can be downloaded and extracted from JavaMail API and JavaBeans Activation Framework respectively and copied to the new ant lib folder (same folder as all the ant-*.jar files)
The ant command (/usr/bin/ant) is a symbolic link to /usr/share/ant/bin/ant; I updated this link to point to the new version (ln -s /usr/local/share/apache-ant-1.7.1/bin/ant /usr/bin/ant)
If for some reason you need to make the old version of Ant the default again, just use
ln -s /usr/share/ant/bin/ant /usr/bin/ant
Steps 2-4 were done at the command prompt as root. That's it -- the Mac now has the latest, complete version of Ant and the Mail task works just fine.
Download the Java Mail libraries from: http://java.sun.com/products/javamail/ .
You will also need http://java.sun.com/products/javabeans/glasgow/jaf.html
A list of all external dependencies required by Ant's optional tasks are outlined here http://ant.apache.org/manual/index.html .
Another way to get dependencies for Ant very easily, is to run:
ant -f fetch all
from $ANT_HOME. You can also run -projecthelp for a full list of targets:
all load all the libraries
antlr load antlr libraries
bcel load bcel libraries
beanshell load beanshell support
bsf load bsf libraries
debugging internal ant debugging
get-m2 Download the Maven2 Ant tasks
jdepend load jdepend libraries
jruby load jruby
junit load junit libraries
jython load jython
logging load logging libraries
networking load networking libraries (commons-net; jsch)
regexp load regexp libraries
rhino load rhino
script load script languages
xerces load an updated version of Xerces
xml load full XML libraries (xalan, resolver)
I also got this working a slightly different way:
Created directory ~/.ant/lib.
Downloaded JavaMail API and copied the jars into that directory.
Downloaded JavaBeans Activation Framework and copied the jars into that directory.
Downloaded Apache Ant 1.7.0 (not the latest, matches the installed version) and copied the apache-ant-1.7.0/lib/ant-javamail.jar file into that directory.
This only solves the problem for a single user account, but that was fine for my purposes and saved me the hassle of having two separate ant installations on my machine.

Categories