I am trying to use the Jaxb classes generator in eclipse to generate jaxb classes from my schema.
I receive the following error:
"The classpath for this project does not appear to contain the necessary libraries to proceed with class generation.
Please insure that a JAXB implementation is available on the classpath."
How can i solve this problem?
After a lot of research here is what I have done to fix the issue.
Windows> Preferences> Java> InstalledJREs...make sure to point your jre to the jdk directory. I was pointing to JRE and as soon as I changed it to JDK, it started working.
Hope this will help you guys.
Make sure to include the jaxb-impl.jar library in your project. You can download one for example from here:
https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.2.4/jaxb-impl-2.2.4.jar
If you're using Maven, you can include this as a dependency, otherwise download the file and add it as a library in your project.
If you need a different version of the library, move up one directory in the link that I added above, you can find other versions there as well.
If you want to automate the class generation, since you're changing the schema on a regular basis, you should automate the process, e.g through Maven.
Windows> Preferences> Java> InstalledJREs > Execution Environment. Select an environment JDK 1.8 and then try to create JAXB Classes.
Click on Below Image Link For Details.
Select the execution Environment
Put the tools.jar in the classpath of the projecct (where the generated code will reside).
I found an explanation here https://bugs.eclipse.org/bugs/show_bug.cgi?id=345617
It does not work because Eclipse only puts the JRE libraries in the classpath of the project. Since the xjc code is in tools.jar you need to provide this extra step.
Download com.springsource.com.sun.tools.xjc-2.1.7.jar
and configure the build path.
This solved the warning and the error for me. Hope this helps.
Related
I wonder if anyone is using codenameone with lombok in Eclipse. I've googled, but all I could find is an old question of mine.
A tiny success
I've tried it, took a demo project, modified nothing and opened it in my Eclipse configured for Lombok. When compiling, I got the same stacktrace as here. I've added
/usr/lib/jvm/java-8-oracle/lib/tools.jar
to the path under Preferences -> Installed JREs -> Edit -> JRE system libraries (which may be a pure non-sense) and it didn't help.
Then I've replaced compiler="modern" by compiler="extJavac" in build.xml and it compiles. I can even use Lombok annotations and they compile and work in the simulator.
The problem
I'm afraid, this was the simple part. I guess, for submitting, I need to replace the source code by the output of delombok. I've tried to submit it as is and nothing happened (no error, no response).
Has anyone done it already?
Any tips?
You shouldn't change the classpath but if the bytecode has access to the properties then it should "just work". If you look at the build.xml file you will notice that it has targets for every one of the supported platforms and before the target occurs you will see a compilation target that packages the JAR that's sent to the servers.
Steve wrote a post about porting other languages to Codename One. This is simple by comparison.
It actually works! All I had to do was to
add the path to lombok.jar to the Java Build Path1
in the javac call of the jar task
replace compiler="modern" by compiler="extJavac"
add the path to lombok.jar to the classpath
1 This is not recommended as the dependency is unavailable on the build server, but that's exactly right. Lombok is a compile-time only dependency and the build seems to be based on the dist.jar, where Lombok has already done its job.
One year later: There was a problem with my old setup, so I installed everything anew and it seems to work. Just note that there are three javac tasks in the build.xml.
I am trying to run GWT RequestFactory and facing this error:
ClassNotFoundException: org.slf4j.LoggerFactory
I have tried to download slf4j-api-1.3.1.jar but it didnt resolve the issue
Any idea exactly which jar I need to download ?
Better to always download as your first try, the most recent version from the developer's site
I had the same error message you had, and by downloading the jar from the above (slf4j-1.7.2.tar.gz most recent version as of 2012OCT13), untarring, uncompressing, adding 2 jars to build path in eclipse (or adding to classpath in comand line):
slf4j-api-1.7.2.jar
slf4j-simple-1.7.2.jar
I was able to run my program.
Try downloading jar from here
You can find, it holds the class you need.
EDIT
Seems like the website has changed its structure. You need to choose which jar file you need for your project.
For slf4j-api jar file for latest version as of now, please visit this link
For slf4j-simple jar file for latest version as of now, please visit this link
i know this is an old Question , but i faced this problem recently and i looked for it in google , and i came across this documentation here from slf4j website .
as it describes the following :
This error is reported when the org.slf4j.impl.StaticLoggerBinder
class could not be loaded into memory. This happens when no
appropriate SLF4J binding could be found on the class path.
Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar,
slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class
path should solve the problem.
SINCE 1.6.0 As of SLF4J version 1.6, in
the absence of a binding, SLF4J will default to a no-operation (NOP)
logger implementation.
Hope that will help someone .
For a bit more explanation: keep in mind that the "I" in "api" is interface. The slf4j-api jar only holds the needed interfaces (actually LoggerFactory is an abstract class). You also need the actual implementations (an example of which, as noted above, can be found in slf4j-simple). If you look in the jar, you'll find the required classes under the "org.slf4j.impl" package.
You'll need to download SLF4J's jars from the official site as either a zip (v1.7.4) or tar.gz (v1.7.4)
The download contains multiple jars based on how you want to use SLF4J. If you're simply trying to resolve the requirement of some other library (GWT, I assume) and don't really care about using SLF4J correctly, then I would probably pick the slf4j-api-1.7.4.jar since the Simple jar suggested by another answer does not contain, to my knowledge, the specific class you're looking for.
add this dependency
https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.28
will help fix error
I got this problem too and I fixed it in this way.
I was trying to run mapreduce job locally through Eclipse, after set the configurations, I met this error (in Linux, Virtual Box)
To solve it,
right click on the project you want to run,
go "Properties"->"Java
Build Path"->"Add External Jars",
then go to
file:/usr/lib/Hadoop/client-0.20, choose the three jars named started
by "slf4j".
Then you'll be able to run the job locally.
Hope my experience will help someone.
Add the following JARs to the build path or lib folder of the project:
slf4j-api-1.7.2.jar
slf4j-jdk14-1.7.2.jar
It needs "slf4j-simple-1.7.2.jar" to resolve the problem.
I downloaded a zip file "slf4j-1.7.2.zip" from http://slf4j.org/download.html. I extracted the zip file and i got slf4j-simple-1.7.2.jar
I had the same on Android. This is how i fixed it:
including ONLY the file:
slf4j-api-1.7.6.jar
in my libs/ folder
Having any additional slf4j* file, caused the NoClassDefFoundError.
Obviously, the rest of the libs can be there (android-support-v4, etc)
Versions:
Eclipse Kepler 2013 06 14 - 02 29
ADT 22.3
Android SDK: 4.4.2
Hope someone saves the time i wasted thanks to this!
I made a project in JavaFX in eclipse. I had to reinstall the system which led to the removal of Java and Eclipse. I project files I had saved. I installed everything again, and decided to create a new project based on the files of the previous using the Maven (Java-JavaFX-Maven). And there is a lot of errors.
Eg.
How should the appeal in this case?
I have a
MainView.fxml
application.css
MainViewController.java and a few filse with class in *.java
.
Parent root = FXMLLoader.load(getClass().getResource("MainView.fxml"));
scene.getStylesheets().add("application.css");
Where should be located xml and css files and what appeal set?
catalogs:
src/main/java/com.pezal
src/main/resources
In the MainView.fxml have set a reference to the controller com.pezal.MainViewController
Throws an exception:
I can not find references
Also I can not build a jar using Maven
The question already asked before but no one has answered the question. I thought maybe it was some internal error and reinstall help.
Why I can't build jar in Maven
If someone can look at this link and help I'd be very grateful.
Eclipse needs to be configured to have the JDK used, per default the JRE will get used, which MIGHT WORK to have maven running, but not for compiling.
Some instruction out on the net: http://www.gamefromscratch.com/post/2011/11/15/Telling-Eclipse-to-use-the-JDK-instead-of-JRE.aspx
For having some example for placing fxml-files and using them inside your code, you might want to checkout some example-project of the javafx-maven-plugin: https://github.com/javafx-maven-plugin/javafx-maven-plugin/tree/master/src/it/08-build-with-proguard
Disclaimer: I'm the maintainer of the javafx-maven-plugin
I have a java project in eclipse and following compile error "The type Vector is not a generic. ...."
I know this error is comming if there are several compiler level/version settings are wrong.
I have added to the build path the JDK1.8:
Also in the Compiler settings I have set Version 1.8:
And last but not least I have also set the correct Java version (1.8) in the Project Facets:
May be I'm blind but where is the project settings with the wrong Java version ....
As I have written in a comment I have "reactivate" a project which is very old ... Not a good idea! Part of the project are also the cldcapi11.zip (which is a jar with a ".zip" suffix) and the midpapi20.jar. Parts of these both jar's also some JDK classes like java.util.Vector and java.util.Timer and some more. For compiling the stuff I must remove both jar's or put both jar's behind the JDK8 library ...
ARRRGH! Who collects official JDK classes in his jar file?!? Not nice...
You can use a "shade" job to move the non-generic JDK Collection classes to a different package (such as backport.java.util.Vector) and update the references in the cldcapi11/midpapi20 jars. This will give you new cldcapi11-shaded and midpapi20-shaded jars that you can include in your apps.
Agreed on the "ARRRGH!"! It's annoying to have to rebuild others' incorrectly built artifacts.
I want my Java application to make a growl notification. My IDEs are Eclipse and Netbeans, and I am trying to implement a library in either (so far it worked it neither). How can I just add the library to my project and then reference the classes from within my own classes? Moreover, where can I find an appropriate library?
Thanks in advance!
EDIT: Ok, now I have somehow managed to implement the library ^^ However: the following command fails:
System.loadLibrary("growl");
It returns following error:
Message: no growl in java.library.path
How can I fix this?
About an appropriate library you should just google it. I found this one (that is tested on 10.5 so maybe it will need some tweaks): http://www.cocoaforge.com/viewtopic.php?f=6&t=17320
To add the library to your project in Eclipse copy it into the project folder (this is not necessary, you could just copy it wherever you want, also in extension folder of the JDK) and then add it through the project settings:
open project properties by right clicking the project and choosing Properties
go to Java Build Path option
go to Libraries and add it
It's possible to use AppleScript script engine in Java 6 on OS X to communicate with Growl. Here's a blog post describing how to do it.
You can use the network binding like in https://github.com/chamerling/JavaGrowl or https://github.com/aerofs/growljavabindings
Maybe this can help you.
If your classes are packaged in a JAR file, just like a 3rd party library, you should be able to put it in your project /lib directory and add it to the CLASSPATH using the IDE. That should be all you have to do (if I understand your question correctly).