After installing CRF++ toolkit, I try to run the program "test.java" under CRF++-0.54/java folder. For this, I type :
java -cp /home/amira/CRF++-0.54/java/org/chasen/crfpp test
But, I have the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: test
Caused by: java.lang.ClassNotFoundException: test
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: test. Program will exit.
In the README file, there is the command java -classpath CRFPP.jar test -d ../dic. But, the problem is that I don't find the classpath of CRFPP.jar. Moreover, I don't understand what ../dic in the command refer to.
Make changes in the Makefile of the java directory as per your machine settings.
Give the correct Java path and the compiler you are using using.
Run make java in the swig directory.
Run make all in the java directory.
Before running make in the java directory, ensure that you have the model file in the proper location, otherwise it won't open the model file.
Run make test in the java directory.
Related
i'm trying to learn a big data online course and came across the problem while installing apache spark.
i've done everything correctly but when i try to run spark-submit it seems that there is an issue with java i guess.
when i run this:
(base) C:\SparkCourse>spark-submit ratings-counter.py
i get this error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.spark.unsafe.array.ByteArrayMethods.<clinit>(ByteArrayMethods.java:54)
at org.apache.spark.internal.config.package$.<init>(package.scala:1095)
at org.apache.spark.internal.config.package$.<clinit>(package.scala)
at org.apache.spark.deploy.SparkSubmitArguments.$anonfun$loadEnvironmentArguments$3(SparkSubmitArguments.scala:157)
at scala.Option.orElse(Option.scala:447)
at org.apache.spark.deploy.SparkSubmitArguments.loadEnvironmentArguments(SparkSubmitArguments.scala:157)
at org.apache.spark.deploy.SparkSubmitArguments.<init>(SparkSubmitArguments.scala:115)
at org.apache.spark.deploy.SparkSubmit$$anon$2$$anon$3.<init>(SparkSubmit.scala:1022)
at org.apache.spark.deploy.SparkSubmit$$anon$2.parseArguments(SparkSubmit.scala:1022)
at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:85)
at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:1039)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:1048)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.nio.DirectByteBuffer(long,int) accessible: module java.base does not "opens java.nio" to unnamed module #5b94b04d
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188)
at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181)
at org.apache.spark.unsafe.Platform.<clinit>(Platform.java:56)
... 13 more
any ideas?
Cheers!
I reinstalled windows and started everything from scratch.
Installed jdk version 8, and this version of spark "spark-3.0.3-bin-hadoop2.7.tgz". Indicated all the paths correctly and. It worked as i can open pyspark shell and do spark-submit for example, but there still is a lot of text in the cmd that i can't get rid of.
I'm trying to run a groovy script which loads data into a Postgresql database. It runs perfectly using IntelliJ but fails when run from the windows command line with the following error:
Caught: java.lang.ClassNotFoundException: org.postgresql.Driver
java.lang.ClassNotFoundException: org.postgresql.Driver
at UploadStressTestData.run(UploadStressTestData.groovy:118)
Apparently, the groovy script can't find the driver class. I need to somehow make that available or loadable from that script.
My question is, how do I do that? Do I need to use the -cp option and tell it where the postgresql driver is?
Any help vastly appreciated.
groovy -cp C:\Users\someuser\workspace\lib\postgresql-42.2.6.jre7.jar UploadStressTestData.groovy
In the simplest case you should be using #Grab to pull dependencies for your scripts:
#Grab('org.postgresql:postgresql:42.2.6')
// do your scripting stuff
The class edu.mit.csail.sdg.alloy4whole.ExampleUsingTheCompiler provides an example of how to execute Alloy commands from the command-line. The backend solver used in this example is Sat4J. I would love to change the solver to one of the faster ones like Plingeling. Unfortunately I can't work out how to achieve this. Simply changing the line
options.solver = A4Options.SatSolver.SAT4J;
into
options.solver = A4Options.SatSolver.PLingelingJNI;
doesn't work; I get the following error message:
Exception in thread "main" Fatal error:
Unknown exception occurred: kodkod.engine.AbortedException: kodkod.engine.satlab.SATAbortedException: java.io.IOException: Cannot run program "plingeling": error=2, No such file or directory
at edu.mit.csail.sdg.alloy4compiler.translator.TranslateAlloyToKodkod.executeCommand(TranslateAlloyToKodkod.java:1079)
at edu.mit.csail.sdg.alloy4compiler.translator.TranslateAlloyToKodkod.executeCommand(TranslateAlloyToKodkod.java:1065)
at edu.mit.csail.sdg.alloy4compiler.translator.TranslateAlloyToKodkod.execute_command(TranslateAlloyToKodkod.java:381)
at edu.mit.csail.sdg.alloy4whole.ExampleUsingTheCompiler.main(ExampleUsingTheCompiler.java:72)
Caused by: kodkod.engine.AbortedException: kodkod.engine.satlab.SATAbortedException: java.io.IOException: Cannot run program "plingeling": error=2, No such file or directory
at kodkod.engine.Solver.solve(Solver.java:147)
at edu.mit.csail.sdg.alloy4compiler.translator.A4Solution.solve(A4Solution.java:1058)
at edu.mit.csail.sdg.alloy4compiler.translator.TranslateAlloyToKodkod.executeCommand(TranslateAlloyToKodkod.java:1070)
... 3 more
Caused by: kodkod.engine.satlab.SATAbortedException: java.io.IOException: Cannot run program "plingeling": error=2, No such file or directory
at kodkod.engine.satlab.ExternalSolver.solve(ExternalSolver.java:255)
at kodkod.engine.Solver.solve(Solver.java:140)
... 5 more
Caused by: java.io.IOException: Cannot run program "plingeling": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:485)
at kodkod.engine.satlab.ExternalSolver.solve(ExternalSolver.java:221)
... 6 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 9 more
The Alloy GUI seems to get around this problem by copying some files (including the plingeling executable) into the right place before it runs.
Thanks to the questions linked from Tarciana's answer, I successfully got this working on my machine (a Mac).
In order to use solvers like Plingeling that are distributed as
executables, one should run
export PATH=<path_to_solver_binaries_and_libraries>:$PATH
before running java.
In order to use solvers like MiniSat that are distributed as
dynamic libraries, one should add the argument
-Djava.library.path=<path_to_solver_binaries_and_libraries>
when running java.
I was with the same problem than yours as shown in my question:
Execution Error when change the SATSolver from SAT4J to MiniSAT
The solution pointed by #Aleksandar in a previous question, see
Alloy API resulting in java.lang.UnsatisfiedLinkError
, works for me in an older ubuntu version (10.0.0) but it does not work in earlier ubuntu versions (such as 14.04 or 16.04).
When choosing another solvers such as zchaff or minisatprover i observe that the error changes, for instance:
"The required JNI library cannot be found: java.lang.UnsatisfiedLinkError: no zchaffx5 in java.library.path"
and for all the other solvers it seems that the library it is looking for (ex.: zchaffx5) is more updated than the existing one in the x86-linux folder (inside the alloy-4.2.jar): zchaffx1. I think the existing libraries for the other solvers are outdated. If you achieve to find a solution for this problem, please let us know.
I've downloaded a prebuilt version of Spark on my mac (OS Mavericks), but when I try to open an interactive shell, typing bin/pyspark, I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/launcher/Main
Caused by: java.lang.ClassNotFoundException: org.apache.spark.launcher.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
I have googled every part of the error and checkout out some other stack overflow threads, but I can't find anything that addresses this error. Any idea what's going on/how to fix it?
One idea I have is that scala is a dependency that I need to download separately...but I really don't know.
I had the same issue before, and it turned out to be a permission issue and I'm under user who has no access to the spark files (root downloaded spark).
Another possibility is, you downloaded the source code and did not build the project from source code :P
Hope it helps.
I am perl, python guy and new to java and groovy.
I am getting this error while running groovyConsole
groovy is working fine.
myhome:~/gscripts # groovyConsole
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:108)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)
Caused by: java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
I have added this
DISPLAY=:0.0
export DISPLAY
To /home/me/.bask_profile and /home/me/.bashrc also But all in vain.
Help me, let me know why this error occurs.
The groovy console is a GUI app and it looks like you're trying to run it in an environment that doesn't support graphics, e.g. connecting to a remote machine via telnet/SSH.
A possible workaround is to use the Groovy shell instead of the Groovy console. The Groovy shell is functionally similar to the Groovy console, but the shell is a command-line, rather than a GUI app.
Assuming the Groovy bin directory is on your PATH variable, you should be able to run it by typing groovysh.