PrintCommandListener is missing - java

I'm trying to upload a file via FTP client using Java, but when trying the:
import org.apache.commons.net.PrintCommandListener;
the PrintCommandListener is show in red. I verified my library and it does include commons.net. What should I do?

PrintCommandListener is in fact in Apache Commons Net. For example, if you download the current version, the jar you need to include in your build path is commons-net-3.3.jar. If this single jar is seen by your compiler, then the class should be recognized. Make sure there are no other classes called PrintCommandListener (for example custom ones that you might have written) in your build path.
If using an IDE (such as eclipse) make sure the jar is on your build path. For example, with Eclipse right click project, go to Java Build Path and click Add JARs. Navigate to the location of your jar file and add it.

Related

Trouble importing libraries from Processing into Eclipse

I had a problem loading sound using the sound.processing library, so I am trying to use the ddf.minim library.
My Instructor imported the sound.processing library into processing AND Eclipse, and I don't remember how he did it. I tried going into processing and downloading minim from the sketch
When I try to import ddf.minim into my project, I get a red line under ddf. I also manually downloaded ddf.minim from github, removed the one previously installed, and I believe I had replaced it with the github files. I then went to add libraries in processing, and I still can't even import ddf.minim in Processing, let alone Eclipse!
Please help, I am just trying to get my sound to work in my Java project!
You need to add the Processing library and the Minim library to your classpath.
In Eclipse, to set your project’s classpath, right-click your project, and then click the Properties option. This brings up a dialog with all the settings you can specify for your project. Click the Java Build Path menu, and then the Libraries tab, which takes you to this screen:
This is your project’s classpath, and any library jars you want to use should be added here. Click the Add External JARs... button and select the .jar files that come with Processing. For basic sketches, I believe you only need the core.jar file.
Then for Minim, you can download the library .zip file from here. Unzip that wherever you want, and it should contain the .jar files that you need to add to your classpath.
Shameless self-promotion: here is a tutorial on using Processing as a Java library, and here is a tutorial on using Eclipse.

How do I add LWJGL 3.1.1 to netbeans to use in a Java project?

I want to use the Light Weight Java Gaming Library(LWJGL) to my Netbeans so I can use it in my Java application. The only videos that I can find show the zip file that they downloaded with separate src and doc folders inside of it. The zip file that I download has everything in one directory. I went to lwjgl.org/download and clicked on Stable and then Generate Bundle. What am I missing?
I had the same problem recently.
So, to begin you want to go to Tools in the context menu and select Libraries (as shown). Next you can add a new library and name it e.g. LWJGL-3.1.1 confirm with ok. You can find 3 tabs in the current window Classpath, Sources and Javadoc. There you add your jar files accordingly (in the downloaded .zip file you find .jar files with different names like lwjgl-{whatever}-sources.jar or lwjgl-{whatever}-javadocs.jar) make sure you put them in the right place. You have to repeat this process for all of the jar files you want. The javadoc files are not required but recommended. Make sure you also collect all the native .dll files and merge them in a folder called \natives. You find them in these jar files that are called like: lwjgl-{whatever}-{your-OS}.jar.
Once you have finished the setup for your library right click on your current project and choose Add Library.... In the window that pops up you scroll down until you find your library that you have just created and you are almost done now.
Last but not least go to the project settings. Select Run and make sure that you set the classpath in VM options to something like in the image: -Djava.library.path="C:\java_workspace\LWJGL Library 3.1\natives. Now this classpath tells netbeans where your native files are located. Your \natives folder that you should have created in the beginning is where this path should lead to. That's it. This is all you have to do for a setup without the use of maven, gradle, ...
You can test if it is working with the code provided by LWJGL HelloWorld example.
I hope this solved your problem.
Best regards.

Processing cannot find library

I've tried importing from a jar file (quickhull3d for example) in Processing 2.2.1 and 3.2.1 on Linux and Mac based on the instructions given here
My directory structure looks like this
../Processing/Sketchbook/libraries/quickhull3d/library/quickhull3d.jar
The Processing IDE preferences set the sketchbook location to ../Processing/Sketchbook
In my .pde file, I have the opening line
import quickhull3d.*;
and I get the error:
No library found for quickhull3d
Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder.
Note: I have seen this question asked repeatedly both here and on the Processing forum and to the best of my ability to tell, I am following the instructions as written. I have restarted the IDE before attempting to run the sketch and I have also tried copying quickhull3d.jar to /mysketch/code, which is manually doing what the IDE would do if you were to drag and drop the file onto it.
Follow up: Upon further investigation, it looks like the problem is that the .jar file itself does not point to the correct locations for the xyz.class files, so I believe this may be the culprit. Additionally, I discovered that the ComputationalGeometry contributed library for Processing contains QuickHull3d, obviating the need for me to install it manually. In the future, I will make certain the paths in the .jar are correct.
If you're using the Processing editor, the easiest way to install a non-standard library is to just drag the .jar file onto your Processing editor. This will move the .jar file into your sketch folder, and you can use it just like you can use any other library.

Referencing .jar files in NetBeans

I am trying to use FEST automation software. I am currently dealing with NetBeans 6.8 because it is what I have to use at work and am unable to upgrade the software at this time because of our system requirements
[TLDR: don't tell me to upgrade NetBeans because I can't]
I have downloaded the jar files from the google code repository and am trying to get a very simple application to work. I have tried adding the jar files to Libraries through the property panel for my project. NetBeans still cannot find these methods. Where else/how do I add these jar files to the class paths?
In order to use .jar files in NetBeans, you can either add the jar file to your global libraries or your local libraries. It sounds like you tried doing it locally without much success. I recommend adding a library such that you can just pick from your list of libraries without needing to reload it. I use NetBeans 8.1 so it may be just a bit different for 6.8.
What you need to do is go to Tools->Library
Then you need to click on New Library at the bottom left of the dialogue box.
AddLibrary
Name it and hit 'Ok'. Then, you'll add a new jar file by specifying your jar path. Hit 'Ok' again to save everything.
In order to use your new library, you'll need to then click on your Libraries folder in your project and add a new library. Select from the list of libraries the library you just created.
SelectLibrary
Finally, you import your individual files in your library using the #import keyword as per usual. If you want to import everything, you'd type something akin to
import MyNewLibrary.*;
To load a library the way you tried to do it, you'd right click the libraries folder and click "Add JAR/folder" instead of "Add Library". Then you'd import everything.
If you still for some reason cannot get your library to work, then you probably aren't importing using the right name. Or, you might be trying to load a static library without using the static keyword.

How to add external third party jar in Notes Xpages application?

I am Java developer, recently working on Xpages project. we are using Notes 9.0.1. I created Java agent to send email and I want to use some third party jar, something like org.apache.commons.lang3 , end up this issue. how to add third party jar, like commons-lang3-3.4.jar, in my Xpages project?
I tried different ways
add jar under /jvm/lib/ext folder, restart DDE.the I can see it in
my project JRE system libray, but could not import in my Java code.
Maybe this is the way for server deployment.
add jar under /Code/Jars and then DDE generated with new name added in /Webcontent/WEB-INF/lib, but...
Add jar directly under /Webcontent/WEB-INF/lib, but not appeared /Code/Jars in Application view
add jar under the Java agent Archive folder, but...
None of them allows me import the package in my Java code.
Anything I did wrong, or is there any good way to add third party jar in XPages project.
Thanks
If you add a JAR to your project by importing it into /Code/JARs, it should be added so as to be accessible by your build path(2,3). The same is true of your /WebContent/WEB-INF/lib, but that may not be automatically defined in your version of DDE; for example, Domino Designer 9 has the design elements of /Code/Java and /Code/JARs, which didn't previously exist (these are separate folders/paths from /WebContent/WEB-INF/src or /WebContent/WEB-INF/lib, either can be in the build path). In either case, if your approach is to have the JAR in your NSF, make sure your build path has the path with your JARs. Separately you could add each JAR individually.
You can get to the Build Path via Project > Properties, then for the part of your build path concerning JARs, go to "libraries":
individual JARs in Project Build Path
JAR class path in Build Path (ex- /WebContent/WEB-INF/lib)
As for the path of using the /jvm/lib/ext folder approach, I've covered that in a blog post and it's important to remember to have the JARs in the appropriate relative path both on the server and in your Designer/local path (otherwise your local, DDE, may not pick up the change).(1)
For both, if you keep build automatically turned off, you'll want to make sure you perform another build to see the changes.
As for a Java Agent archive, this should just work and again I'm wondering whether your build automatically setting is enabled/disabled. The /jvm/ext/lib path ought to work for this as well (shown in my linked blog post).(4) *Note: as Paul Withers points out in the comments, importing a JAR to a Java Agent can introduce memory leak issues, making the /jvm/ext/lib/ path preferable.

Categories

Resources