recently I am using Drools in eclipse. When I was running program, there is one exception:
org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:310)
at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:295)
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:184)
at org.drools.compiler.PackageBuilderConfiguration.(PackageBuilderConfiguration.java:162)
at org.drools.compiler.PackageBuilder.(PackageBuilder.java:277)
at org.drools.compiler.PackageBuilder.(PackageBuilder.java:205)
at org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)
at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:46)
at com.adsc.cybersage.rules.DroolEngineInit.readKnowledgeBase(DroolEngineInit.java:48)
at com.adsc.cybersage.rules.DroolEngineInit.initializeDrools(DroolEngineInit.java:32)
I search online and found that this is because I didn't add eclipse JDT library org.eclipse.jdt.core.jar, then I add this jar and the program works well. But I don't want to add eclipse JDT Library because its license is strict. So is there any alternative jar which is under a not strict license I can use?
I am compiling and running Drools without org.eclipse.jdt.core.jar, calling javac and java from the command line (actually, a shell script).
PROTOBUF=protobuf-java-2.4.1.jar
root=/extra/drools-distribution-5.5.0.Final/binaries
tag=5.5.0.Final
export CLASSPATH=".:$root/drools-core-${tag}.jar:$root/knowledge-api-${tag}.jar:$root/knowledge-internal-api-${tag}.jar:$root/drools-compiler-${tag}.jar:$root/antlr-2.7.7.jar:$root/antlr-3.3.jar:$root/antlr-runtime-3.3.jar:$root/ecj-3.5.1.jar:$root/mvel2-2.1.3.Final.jar:/extra/quartz-1.8.3/quartz-1.8.3.jar:$root/drools-decisiontables-${tag}.jar:$root/drools-templates-${tag}.jar:$root/xstream-1.4.1.jar:$root/jxl-2.6.10.jar:$root/slf4j-api-1.6.4.jar:$root/$PROTOBUF"
Then javac and java are called.
Of course, when you are running within Eclipse, you may indeed need Eclipse stuff. You can develop and test under Eclipse and then compile DRL and execute your application using the aforementioned technique.
Related
I have an Ant script with some <script> tasks and it is supposed to run with:
-Djavac.compiler=org.eclipse.jdt.core.JDTCompilerAdapter
That is, it relies on running in the same JRE as Eclipse. When I try to launch this Ant script in the latest Eclipse it fails with:
Java 15 has removed Nashorn, you must provide an engine for running JavaScript yourself.
BUILD FAILED
buildJars.xml:86: Unable to create javax script engine for javascript
I downloaded Nashorn and its dependency jars and added them to the Ant runtime in Window/Preferences, but it didn't change a thing.
Download nashorn-core-15.0.jar and its dependencies (with maven). Copy all jars into a known place, say C:/keep/eclipse/nashorn
Edit eclipse.ini and add below -vmargs:
--module-path=C:/keep/eclipse/nashorn
--add-modules=ALL-MODULE-PATH
Don't replace the existing --add-modules=ALL-SYSTEM. That one is required by Eclipse
I have developed an eclipse plugin, which is compiled linux using maven Tycho plugin. But for some reason, I am not able to see the plugin in the eclipse running on windows. I am not finding anything in the log file.
As I am new to plugin development, Is there any difference does a cross platform compiled plugin would cause?
One dilemma I have in my mind is that, Does it really matter if I use windows based eclipse installation on linux, (as it is just a zip, extract it and use it) machine for compiling and building my plugin? Well, to me it appears that it does matters. I should use linux based eclipse for compiling a plugin in linux operating system.
But isn't this what is against java principle? Compile and Run anywhere?
as far as I know, if you are using UI stuff inside that plugin then you have to export it for multiple OSes ... and you need some libraries from eclipse website to export your application in linux...
If you are exporting only the plugin then you need nothing... OSGI takes care of everything
Some of the Eclipse packages are system dependent. To take one example, org.eclipse.core.resources.win32.x86 would work only on a 32 bit Windows workstation.
Check your plug-in and see if you have any of these system dependent Eclipse packages.
If you do, you have to export your plug-in with the appropriate Eclipse packages for each of the environments you want your plug-in to run.
Write once, run anywhere is a myth. Ask any Android programmer. :-)
Can I execute Eclipse Java development tools as a standalone process? I need to get Java program's AST structure using Eclipse JDT from another program, and to do that, I need to execute eclipse plugin as a stand-alone process behind the scene.
Is that possible? If so, how one can do that?
Eclipse/jdt and eclipse/ast is nothing more than a jar file, so one can use them to build standalone java application.
Example
I googled to find ASTExplorer as an example to make eclipse/ast plugin as a standalone java project.
The program was targeted for pretty old eclipse (3.0.2), I downloaded the 3.0.2 for Mac OS X this site - http://archive.eclipse.org/eclipse/downloads/drops/R-3.0.2-200503110845/
You need to setup ECLIPSE_HOME classpath variables in Preference -> Java -> Classpath variables
The .classpath has those classpath variables already, you can refer to this post - .classpath contents update in eclipse. As you can see it refers eclipse/jdt(art) jar files. I'm pretty sure one can change the reference to the newest version of jdt/ast without downloading the 3.0.2 version.
As I use Mac, I need to replace the swt for PC with swt for Mac. I could do that in BuildPath/Configure Build path
First remove the PC swt reference.
Then add the correct Mac swt reference.
Compile the example with the eclipse indigo/on mac
When the setup is correct, eclipse starts building the project. You can use Project -> Build Project menu. Then, you can check the application works fine in eclipse.
Generate the executable jar
Export to executable jar file.
You'll get some warnings, but you'll have a jar file.
Execute the generated jar
Just executing java -jar ast.jar doesn't work on Mac, I got a hint from this post.
Running SWT based, cross-platform jar properly on a Mac
In short, you need to run java -XstartOnFirstThread -jar ast.jar
Does it have to be Eclipses's AST? Or is any AST generation o.k.? If it doesn't have to be eclipse, I'd suggest Habelitz open source Java AST Compiler. http://www.habelitz.com/ I'm using it myself for some projects....
Well, of course you can launch eclipse just like any other process : How to create a process in Java
And then the problem becomes relaying the information back to the original process, which gets kind of messy. My suggested approach in this case would probably be to create a plugin in eclipse and have that plugin do whatever it is you think you need the AST for. You can work out messages with command line options to eclipse, or a shared file or something.
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?
I want to run cucumber in my java project directly through jruby without having to use Ant or Maven. I have installed cuke4duke through jruby and have it up and running. I can run the feature files but I have problem in getting my step definition recognized by cucumber. Although I have the step definition folder, implementations are shown as pending to me.
What can I do to resolve this.
It's not supported yet, feel free to vote for this feature request.