Sphinx classes not found despite library being in classpath? - java

I downloaded sphinx4-1.0beta6-bin.zip and installed it on my 64-bit Ubuntu 12.04 LTS. I was able to run the HelloWorld example. However, when I create my own class and create a Configuration object as shown here:
Configuration configuration = new Configuration();
It gets flagged as an error. Eclipse cannot find the class at all even though I have appropriate jars in the library and library is in the build path.
Here are the jars in the library:
js.jar
jsapi.jar
sphinx4.jar
tags.jar
Then, why am I getting this error ?

This class doesn't exist in released version, to use it you need to checkout an experimental hl-interface branch with subversion:
http://sourceforge.net/p/cmusphinx/code/HEAD/tree/branches/hl-interface/
To learn more about subversion see
http://www.ibm.com/developerworks/library/os-ecl-subversion/

Related

Can't integrate SWT with JavaFX under "Zulu" JDK 11

We want to use both SWT and JavaFX in an Eclipse plugin within our RCP application. Unfortunately, we're experiencing problems integrating SWT with JavaFX under Java 11. The build environment uses e(fx)clipse 3.5. We're developing against the Community edition of Azul Systems' "Zulu" JDK 11, bundled with Azul's version of OpenJFX.
Formerly, we developed under Java 8. At that point, our build used a compile-time class path referring to jfxswt.jar, which lived in the jre/lib directory of the JDK. We didn't use any special class path settings at run-time.
We are now trying to move to Java 11. There, this JAR has become javafx-swt.jar and lives in the lib directory of the JDK. It no longer seems to be enough to set the class path to refer to this JAR at compile time: it seems to be necessary to do so at run time too. If we don't do this, we get an error (java.lang.NoClassDefFoundError: javafx/embed/swt/FXCanvas).
As a test, we experimentally embedded javafx-swt.jar within the JAR implementing our Eclipse plugin. We then referred to it in that plugin's .classpath file, and the code worked as expected. Unfortunately, we can't embed the JAR this way for legal and other reasons.
A note on Java modules: javafx.swt does not show up in the output when we issue the --list-module command. We tried running the application using parameters -p /path/to/JDK/lib/javafx-swt.jar --add-modules javafx.swt, but this doesn't seem to solve the problem.
My question: Is there a way to set up the class or module path to allow our Eclipse plugin to find this library in the JRE? Any solution would have to work with whatever JRE the code happens to be run against (I think it is all right to assume lib/javafx-swt.jar will live in that JRE).
Would it help to use a separately-downloaded version of OpenJFX rather than the copy of OpenJFX in our JDK?
Very many thanks ☺

Java 8 - Can not import java.util.Arrays [duplicate]

I just encountered a strange error when switching the JDK version of a new Project of mine from 7u45 to 8u20. A harmless LogManager declaration at the beginning of my class is being refused with the following error:
The type java.lang.reflect.AnnotatedElement cannot be resolved. It is indirectly referenced from required .class files
This is the code:
public class Class1 {
private static Logger log = LogManager.getLogger(Class1.class);
...
Eclipse proposes me to configure the build path, but I have no Idea what to configure because I don't know the underlying problem of that error.
Using the JDK with version 7, everything works fine.
When using JDK 8 and an IDE (or any other code processing tool/framework) with its own compiler, like Eclipse, you have to update the tool to a version with Java 8 support, even if you are not using the newer Java 8 features.
The reason is that the compiler must be able to load the newer class files of the JRE in order to compile your software which references these classes.
Sometimes you can get away with an older compiler when it ignores the newer version number of the class files. But some types will confuse older class file parsers as they use new features, notably AnnotatedElement, which now has default methods, and Map.Entry, an interface which now has static methods.
It seems that Eclipse does not make a difference between references for which no class file could be found and class files it failed to read when saying “«classname» cannot be resolved”.
The same applies to all tools and frameworks using ECJ as embedded compiler.
If this happens to you in Tomcat running from within Eclipse (question was closed as duplicate and redirects here), go to Preferences → Server → Runtime Environments → Tomcat version → Edit… and make sure the selected JRE matches the Tomcat version. (Maybe you need to install one.)
Solution 1:
Try changing the source level.
Go to Project > Preferences > Java Compiler.
Enable Project specific settings
Set compiler compliance level to 1.4 or below.
Restart
Solution 2:
Create a new workspace.
Copy project files into the new workspace.
Import project into eclipse and rebuild.
I change from JRE 8 to JRE 7 and restart Eclipse then it works fine.
I was using Eclipse Helios with JRE 8 and updating the software solve the problem.
Now I'm using Eclipse Mars and works just fine -> https://eclipse.org/downloads/

Error when using LogManager (l4j2) with Java 8 (java.lang.reflect.AnnotatedElement cannot be resolved)

I just encountered a strange error when switching the JDK version of a new Project of mine from 7u45 to 8u20. A harmless LogManager declaration at the beginning of my class is being refused with the following error:
The type java.lang.reflect.AnnotatedElement cannot be resolved. It is indirectly referenced from required .class files
This is the code:
public class Class1 {
private static Logger log = LogManager.getLogger(Class1.class);
...
Eclipse proposes me to configure the build path, but I have no Idea what to configure because I don't know the underlying problem of that error.
Using the JDK with version 7, everything works fine.
When using JDK 8 and an IDE (or any other code processing tool/framework) with its own compiler, like Eclipse, you have to update the tool to a version with Java 8 support, even if you are not using the newer Java 8 features.
The reason is that the compiler must be able to load the newer class files of the JRE in order to compile your software which references these classes.
Sometimes you can get away with an older compiler when it ignores the newer version number of the class files. But some types will confuse older class file parsers as they use new features, notably AnnotatedElement, which now has default methods, and Map.Entry, an interface which now has static methods.
It seems that Eclipse does not make a difference between references for which no class file could be found and class files it failed to read when saying “«classname» cannot be resolved”.
The same applies to all tools and frameworks using ECJ as embedded compiler.
If this happens to you in Tomcat running from within Eclipse (question was closed as duplicate and redirects here), go to Preferences → Server → Runtime Environments → Tomcat version → Edit… and make sure the selected JRE matches the Tomcat version. (Maybe you need to install one.)
Solution 1:
Try changing the source level.
Go to Project > Preferences > Java Compiler.
Enable Project specific settings
Set compiler compliance level to 1.4 or below.
Restart
Solution 2:
Create a new workspace.
Copy project files into the new workspace.
Import project into eclipse and rebuild.
I change from JRE 8 to JRE 7 and restart Eclipse then it works fine.
I was using Eclipse Helios with JRE 8 and updating the software solve the problem.
Now I'm using Eclipse Mars and works just fine -> https://eclipse.org/downloads/

Class not found exception for com/google/appengine/tools/enhancer/Enhance when starting eclipse

I did a fresh download of Eclipse Juno and installed Google App Engine SDK.
After this whenever I start eclipse I get an error
Could not find the main class:
com.google.appengine.tools.enhancer.Enhance. Program will Exit.
Edit:
Looks like there is a Builder that gets added by the Google AppEngine Plugin. Eclipse tries to find this "Builder" and fails.
I added the path to this builder which resides in plugins\com.google.appengine.eclipse.sdkbundle_1.8.3\appengine-java-sdk-1.8.3\lib to my system classpath.
Now I get a different error
DataNucleus Enhancer (version 3.1.1) : Enhancement of classes
Aug 21, 2013 8:48:14 PM org.datanucleus.metadata.MetaDataManager loadClasses
SEVERE: Class "in.chimanrao.model.Account" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
org.datanucleus.exceptions.ClassNotResolvedException: Class "in.chimanrao.model.Account" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
How do I pass custom classpath to this DataNucleus Enhancer?
I solved it by installing JDK 1.7 and making it the default in Eclipse.
If you work with a database, install the previous version JDK 7u21 because the latest version has some issues with databases.
As others have noted, you must use JRE1.7 or above. What isn't stated is that it may be necessary to update Eclipse to use 1.7 and then your project. It may also be necessary to remove the earlier JRE version from the project's buildpath. Detailing all of the steps here is a bit much but I found that the following tutorial includes all necessary steps:
https://spragucm.wordpress.com/2015/05/11/class-not-found-exception-for-comgoogleappenginetoolsenhancerenhance-when-starting-eclipse/

Java Advanced Imaging "PlanarImage" class not found

Let me start by saying I've recently inherited a Java application written using Eclipse. I'm new to this language/IDE, but I have a lot of experience with C# and Visual Studio. So, my problem may be something very silly, but I have a foundation so I'm not a total programming newb.
I'm exporting this project as a runnable JAR, using a launch configuration provided by the original developer. I have tried this with both "Extract required libraries into generated JAR" and "Package required libraries into generated JAR". Either way, I get the following error when I launch the application:
java.lang.NoClassDefFoundError: javax/media/jai/PlanarImage
I launch the application using this command, where appName.properties is a properties file that's required for running the app:
java -jar appName.jar appName.properties
This occurs multiple times from separate stack traces. I'm not seeing any other runtime errors or compile errors. My JRE system library is jre1.5.0_05. I installed JAI by downloading jai-1_1_3-lib-windows-i586-jre.exe from http://download.java.net/media/jai/builds/release/1_1_3/ and installing it into the jre5 directory. My project did not compile until I got this specific version of java, and installed the JAI jre into that version's folder, so I am fairly certain I have that part together correctly.
Finally, here is my classpath:
C:\Program Files (x86)\Java\jre1.5.0_05\lib\ext\jai_codec.jar;C:\Program Files (x86)\Java\jre1.5.0_05\lib\ext\jai_core.jar;C:\Program Files (x86)\junit4.10\junit-4.10.jar;.
Is there anything obvious I'm doing wrong here? Is there any other information that would be helpful in figuring out why I'm getting this error?
Make sure the jar is in your classpath. Are you running from an IDE or from command line?

Categories

Resources