Hi all I have a java program inside it I have imported these classes.
import com.hp.hpl.mesa.rdf.jena.mem.ModelMem;
import com.hp.hpl.mesa.rdf.jena.model.*;
import com.hp.hpl.mesa.rdf.jena.common.PropertyImpl;
when I'm trying to compile the program it shows 3 errors which are:
package com.hp.hpl.mesa.rdf.jena.mem does not exist import
com.hp.hpl.mesa.rdf.jena.mem.ModelMem;
package com.hp.hpl.mesa.rdf.jena.model does not exist import
com.hp.hpl.mesa.rdf.jena.model.*;
package com.hp.hpl.mesa.rdf.jena.common does not exist import
com.hp.hpl.mesa.rdf.jena.common.PropertyImpl;
I have tried to search for the jar files but I couldn't, is anyone has the link to download the jar file of those packages.
The Jena packages are under com.hp.hpl.jena.rdf…. I don't know where you got this com.hp.hpl.mesa.rdf.jena… package name from, but it's definitely wrong. Maybe you're using an obsolete example from an ancient Jena version?
There shouldn't be any reason to import ModelMem or PropertyImpl directly. If you need a ModelMem, use ModelFactory.createDefaultModel(). If you need a property instance, use model.createProperty().
You can download the Jena jars from the Jena download site.
Related
Is there any recommendation how to import local files. In my case I would have 2 options:
import 'package:workshop/feed/item.dart';
import 'item.dart';
I haven't found anything on that on the guide Effective Dart: Style nor on Google search.
There are at least two different recommendations, depending on who you ask.
Either works, I personally recommend the latter, shorter, variant.
It is sufficient and it avoids the issue of hard-coding your package name into every file. If you ever want to rename the package, that will be a drudge.
There is one issue which makes some people recommend the former format.
If you import a package library using a non-package: URI, say by having a file in the bin/ or test/ directory do an import like:
import "../lib/mylib.dart";
then that library is now imported using two different URIs:
package:mypkg/mylib.dart and
file:///somewhere/mypkg/lib/mylib.dart
Since Dart identifies libraries by their import URIs, these two imports will be treated as different libraries, each with their own global and static variables, which just happen to have the same source code. That's an annoying problem, and can be hard to debug. If you use the long package:... import everywhere, then at least the issue is restricted to the first library you import. If you use a relative import, import "src/helper.dart";, then that library will now also exist in two versions:
package:mypkg/src/helper.dart and
file:///somewhere/mypkg/lib/src/helper.dart
The real issue here was the first import which contained a /lib/ in the path. You must never have such an import. Using package: URIs for all imports may reduce the issue, but not remove it.
I recommend using the relative path, and making sure that you never have a /lib/ in any import path. Libraries in the /lib/ directory of a pub package are package libraries and should be referred to using package: URIs. If you do that, then relative URIs will be resolved against the package URI and again be a package URI, and all is well.
As the question is self-explaining, assume in the folder I have multiple Dart file. Instead of importing file by file (for example import 'screens/screen_1.dart'; import 'screens/screen_2.dart';...), I want to batch import (such as import 'screens/*.dart') but it doesn't work.
Do you know Dart allows us to do such batch import?
Dart imports don't support importing multiple files at once.
What you can do is creating a library that exports other libraries
screens.dart
export 'screens/screen_1.dart';
export 'screens/screen_2.dart';
export 'screens/screen_3.dart';
foo.dart
import 'screens.dart';
I'm currently studying the source code of Firefox-iOS app by creating my own Swift project and typing the code line by line.
In one of the source code files, it imported a packaged named Storage
But I don't think the package Storage is part of the apple API and I don't really know how I can import it.
Edit
Multiple podfiles are present in the project folder
In Swift you dont import other Swift files as they are readily available to use directly.
But you need to import another module. It looks like Storage here is a module inside the firefox-ios app workspace and hence you need to import it before using it.
I looked at the sourcecode at Github and it does contain a package named Storage.
You can read this to understand more about Modules and import statement.
I am developing a module in which some file need to be uploaded on a ftp server for that I have added the "commons-net-3.3.jar" in my grails app & while using it
import org.apache.commons.net.ftp.FTP
import org.apache.commons.net.ftp.FTPClient
import org.apache.commons.net.ftp.FTPClientConfig
import org.apache.commons.net.ftp.FTPFile
import org.apache.commons.net.ftp.FTPReply
It is throwing the error unable
to resolve class org.apache.commons.net.ftp.FTPReply.
In ggts I am able to see all the classes of this package but it throw the error at runtime. What can be the possible solution for this?
In Grails you rarely add jar files to the project, you normally add dependencies. In your case you should add this line to the BuildConfig.groovy (section grails.project.dependency.resolution.plugins)
compile 'commons-net:commons-net:3.3'
Say I got a bunch of dart scripts in a folder,
Is there anything I can do like import 'foo/*.dart'?
P.S. What if I got an array of filenames and wanna import those files?
You need to import each library individually.
What you can do is to create a library that imports all other libraries and reexports them.
you can then import this one library and get all libraries imported at once.
library all_in_one;
export library1.dart;
export library2.dart;
export library3.dart;
You could also use the "part of" library composition:
Create 1 .dart file that is your lib eg.: lib.dart and add at the start of this file.:
library lib
For every file in your folder add a:
part "somefile.dart"
part "otherfile.dart"
In all files that are part of this library add at the start:
part of lib
In other files and libs you can then import all those file just via:
import "lib.dart"
This will import all the parts of your library (folder). Keep in mind that the "lib.dart" file is now responsible for all the imports of your lib files. So to import something to "somefile.dart" you add the import to "lib.dart". All imports are then available in all the lib files.
This would be highly unsecure, this is why it is not allowed by design. An attacker would be able to run any malicious code just adding a file with the right name to your folder.