import packages in cordova plugin - java

I'm building a plugin for a PDA3505 device, which must print texts using the integrated printer.
In the plugin's main Java file, I have this import: import com.pda3505.printer.PrinterClassSerialPort;
When I add the plugin to my app and try to make a build, I get this error:
error: package com.pda3505.printer does not exist
import com.pda3505.printer.PrinterClassSerialPort;
Where do I have to put the package for the plugin to work?

If you have .jar files for the PDA SDK, then you have to put it in a folder within the code and add a lib-file entry in the plugin.xml so it's copied to your project.
<lib-file src="src/android/libs/lib.jar"/>

Related

Can't import class from jar file in IntelliJ

So I am trying to import this class from my jar file. IntelliJ recognizes access to all the folder structures but not the class.
Says: "Cannot resolve symbol 'Constants'.
Note that I have tried clicking "Add library 'premiumdue.main.jar' to classpath" and it still doesn't work.
I have no idea why it won't let me import the class.
Here is a minimal intellij project showing my issue: https://www.dropbox.com/s/xzvv2x1ca2lld26/jar_issues.zip?dl=0
For your sample Gradle project, the dependency jar has to be referenced in build.gradle file as described in this answer.
dependencies {
implementation files('../create_jar.jar')
}
Proof:

How do I set up extJWNL in a Java project?

I am trying to determine whether a set of strings, from an English sentence, are all words from the WordNet dictionary. I put the JARs in a folder in my project in eclipse.
I've downloaded the binary release of extJWNL and put the JARs in a folder called lib.
I also added these jar files to the class path and the module path using Right Click > Build Path > Configure Build Path:
I used the following code to try to import dictionary
import net.sf.extjwnl.dictionary;
This error is shown on the import statement
The package net.sf.extjwnl.dictionary is accessible from more than one module:
<unnamed>, extjwnl
I thought that this error was showing up because it was a package, not a class/type. But adding a new class and trying to change the package doesn't show this new package, namely WORDNET_JARS, just the default package.
Why is this error being returned and what do I need to do to get rid of the error and import the wordnet packages?
Platforms
I am using Eclipse IDE, and write all this code in Java. The API I am trying to import is the WordNet API.
Edit (8/21/2019)
By removing the module path, it gives a new error:
Only a type can be imported. net.sf.extjwnl.dictionary resolves to a package
I'm surprised it was this easy:
Instead of
import net.sf.extjwnl.dictionary
I had to do
import net.sf.extjwnl.dictionary.*
to get all the types. The only other thing that had to be done had already been done where I add the JARs to the class path

How to add RabbitMQ library to project? 'The import "com.rabbitmq" cannot be resolved'

I am working through the RabbitMQ Java tutorial found here: https://www.rabbitmq.com/tutorials/tutorial-one-java.html
I have downloaded the Java Client Library package, and copied the JAR files to my project in Eclipse, but the import statements
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
all yield the error
The import "com.rabbitmq" cannot be resolved.
The instructions are unclear how to incorporate the JAR files from the Java Client Library package, how should I proceed?
You can download the rabbitmq-java-client-bin-3.5.4.zip from official link here . Then extract the rabbitmq-client.jar from the zip & add it to your class path in project. Then you will be able to resolve The import "com.rabbitmq". Give it a try.
Since the verified answer doesn't work anymore, here is my solution:
You can download the amqp-client-5.8.0.jar from here . Then add it to your class path, like any other jar.
In case that the link doesn't work, you can manually download it from here or even add the required dependency to your maven/gradle project.
For Visual studio code(vscode) we need to add the library file under Referenced Libraries enter image description here under the Java projects section.
enter image description here.imgur.com/txB2s.png

Eclipse Zest plugin source code from github gives manifest.mf error

I am a newbie to eclipse and eclipse plugins. I want to use zest project, with making some specific extentions . So I downloaded eclipse zest plugin source codes from the link below , I am trying to build this project under eclipse 3.7 . But manifest.mf gives error in this lines
org.eclipse.zest.internal.dot.parser.dot,
org.eclipse.zest.internal.dot.parser.dot.impl,
org.eclipse.zest.internal.dot.parser.dot.util,
org.eclipse.zest.internal.dot.parser.parseTreeConstruction,
org.eclipse.zest.internal.dot.parser.parser.antlr,
org.eclipse.zest.internal.dot.parser.parser.antlr.internal,
When i open the packages above, there are some missing files. For example , i see that there is no source of the classes below.
import org.eclipse.zest.internal.dot.parser.dot.AList;
import org.eclipse.zest.internal.dot.parser.dot.AttrList;
import org.eclipse.zest.internal.dot.parser.dot.AttrStmt;
import org.eclipse.zest.internal.dot.parser.dot.Attribute;
import org.eclipse.zest.internal.dot.parser.dot.AttributeType;
import org.eclipse.zest.internal.dot.parser.dot.EdgeRhsNode;
import org.eclipse.zest.internal.dot.parser.dot.EdgeStmtNode;
import org.eclipse.zest.internal.dot.parser.dot.GraphType;
import org.eclipse.zest.internal.dot.parser.dot.MainGraph;
import org.eclipse.zest.internal.dot.parser.dot.NodeId;
import org.eclipse.zest.internal.dot.parser.dot.NodeStmt;
import org.eclipse.zest.internal.dot.parser.dot.Stmt;
import org.eclipse.zest.internal.dot.parser.dot.Subgraph;
import org.eclipse.zest.internal.dot.parser.dot.util.DotSwitch;
I am not able to build from source ,-I think- since there are some missing source codes in git link.
do you have any solutions thank you .
The dot parser is an Xtext project that needs source code generated. At this point, it needs two manual steps:
Create a src-gen folder in the root folder of org.eclipse.zest.dot.core - this will become a source folder. Git does not upload empty folders in git.
Similarly create a src-gen folder in org.eclipse.zest.dot.ui.
Execute the org.eclipse.zest.dot.core/src/org/eclipse/zest/internal/dot/parser/GenerateDot.mwe2 workflow file (Run as/MWE2 workflow). This will generate all necessary code. If you did not create the source folders, this step would fail with a really cryptic error message.

The import javazoom cannot be resolved

hi all
i use the javazoom.jl.player.Player package but it is says The import javazoom cannot be resolved. i am using eclipse and doing Android project. i clean the project still the same error is shown. please correct me.
If eclipse can't resolve a package fragment of an import statement, then it tells you (with that error), that there is no library on the classpath that contains a class from that package (or from a package whose name starts with the missing part).
An easy way for standard java/eclipse:
create a folder lib in your projects root directory (with the eclipse workbench!)
copy and paste the jar into that folder
right-click the copied jar and select "add to build path".
This should eliminate the compiler errors immediately.
(Previous part of the answer)
Taking the error message literally, it looks like you have a line of code like that:
import javazoom;
This would be wrong, because we don't import packages but classes from a package. To import all classes from the javazoom package, we'd say:
import javazoom.*;
You should download the .jar of jLayer ( http://www.javazoom.net/javalayer/sources.html )
And add into classpath in the way Andreas_D told you.

Categories