Error when importing java class in jruby script - jruby

I want to use HermiT reasoner in my jruby script as described here http://hermit-reasoner.com/java.html. As described there I have to have HermiT.jar in my classpath. So I did require for jar file and also I want to import Reasoner class. My script looks like this:
require "java"
require "HermiT.jar"
java_import org.semanticweb.HermiT.Reasoner
But I get an error: Missig class or uppercase package name ('org.semanticweb.HermiT'). But 'org.semanticweb.HermiT' should be icluded in HermiT.jar... Is there any way how to find out what is really included in jar file and can you reproduce this problem? Thank you very much.

The problem is probably the name of package (because of capital letters?).
Everything is ok when I write package name with quotes:
java_import 'org.semanticweb.HermiT.Reasoner'

Related

How can I require a directory in ES6?

I know I can require a file in ES6 like this:
require('./config/auth');
When I try to do this
require('./config/');
I get: Module not found: Error: Cannot resolve directory './config'. Why does this happen? How can I require a directory?
First of all, your requires are in NodeJS/io.js syntax, module in ES6 syntax looks like this:
import "./config/auth";
Or if you want to load something from it:
import authenticate from "./config/auth";
You can't load whole directories at once, but in Node/io.js you can create a module and then load that.
Note that as a workaround you can load a single file that in turn loads multiple files and returns their results. There is also work in progress on an asynchronous loader but that changes so often it's hard to keep track so I wouldn't rely on it just yet.
I personally use a package called require-dir. This should work for you:
import requireDir from 'require-dir';
requireDir('./config');

Plone/SQLAlchemy(?) - How can I import a python package (i.e. sqlalchemy) in a module in a subpackage?

I am trying to import sqlalchemy in a module in a subpackage.
Here is my folder layout
PloneInstance
my.package
my
package
subpackage
In the buildout.cfg file of the root folder, I add "sqlalchemy" to the eggs.
In my.package, in configure.zcml, I add:
In the subpackage, I have a blank __init__.py file, a configure.zcml file, and a file called mymodule.py
In mymodule.py I have a line for importing sqlalchemy
import sqlalchemy
Unfortunately, I am getting an error when I try to run an instance:
ImportError: No module named sqlalchemy
I'm assuming I am missing a step. How do I properly import python packages?
Thank you in advance. I apologize if my terminology is off.
Edit:
The module in question I am importing from turned out to be zope.sqlalchemy.
I accidentally overlooked this because prior to moving files to a subpackage, the import statement for zope.sqlalchemy was working without adding zope.sqlalchemy to the eggs section of the buildout.
Look in the setup.py file at the top directory of your package. You'll find a section like:
install_requires=['setuptools',
# -*- Extra requirements: -*-
],
In place of the "Extra requirements' comment, put a comma-separated list of strings specifying your package's requirements. You may even specify versions.
Do not add standard Plone packages to the list. They're taken for granted.
Re-run buildout after specifying your requirements. The result is that the new install requires will be added to your Python environment when you start Plone.

How to import own packages in Flash Builder?

I am new to Flash Builder so this is an easy question for anybody who has some experience with flash builder and actionscript 3.0.
So basically I have a folder with .as files. The directory of it is -
...\src\assets\Stadium\MyClass
Now I want to use it in my Flash Builder Project, but when I import like this -
import assets.Stadium.MyClass.PrefabProject;
There are warnings ... look in the image below.
How can I possibly use the contents of the folder in my as3 code.
How can I use the folder as a package?
EDIT: I went ahead and tried to use the stuff from the package in the code - This is the error I got -
A file found in a source-path must have the same package structure 'assets.Stadium.MyClass', as the definition's package, ''. MyClass.as /proj_away_alpha_new/src/assets/Stadium/MyClass Unknown Flex Problem
The error you have posted in your edit seems to imply that your package statement in MyClass is empty. The package statement should contain the same path that your class is in.
Since MyClass.as resides at the path (relative to your project): assets/Stadium/MyClass
The package statement (at the top of MyClass.as) should be the same:
package assets.Stadium.MyClass
I may have interpreted that error incorrectly. Just make sure that the package statement in MyClass.as is the same as the location of the class file on disk (relative to the project's src directory).
PS: The only time you use an empty package statement is when your class resides in that special "default package" (where your main app is).

MXMLC compiler missing filesystem library

I've had not trouble until this point directly from MXMLC command line. While compiling Actionscript 3 code I ran into a dependency problem.
import flash.filesystem;
and I get
Error: Definition flash:filesystem could not be found
There are another or two file-related libraries such as filestream. Where can I find these standard libraries and how might I add them to my MXMLC library PATH?
What are the specific classes you are trying to use? If you want to import all of the classes in the flash.filesystem package you need a * at the end of that import statement. Otherwise you need to append the class name(s). Something like one of these:
import flash.filesystem.*;
or
import flash.filesystem.File;
The other thing that might be an issue is the values in your flex-config.XML (or air-config.xml) file that is part of the SDK. You might need to configure this to include the classes in the AIR sdk, etc.

importing weka in java after installing weka

i stalled weka in my system but still im having problem to use weka classes in my java code?
im using netbean its show me class file not available when i try to import my weka class?
http://wiki.forum.nokia.com/index.php/Adding_a_new_library_to_NetBeans ?
The package view of a weka test project :
1) Adding weka.jar into your Java project classpath.
2) Importing the class you want to load like this import weka.XXX.XXX;.
Make sure the above two simple steps is done. Any question :)