we are trying to implement a web application for "Database Managment Systems" lecture.
We have used native wicket. (Not maven wicket repo, because i don't have a pom.xml file)
I want to use the Wicket Bootstrap DatePicker in the project. (http://agilecoders.de/demo/datepicker)
Can i use this datepicker extension in my project?
I downloaded the wicket bootstrap from github. (github(dot)com/l0rdn1kk0n/wicket-bootstrap/)
I found the sample file html/java codes. It imports these:
import de.agilecoders.wicket.core.markup.html.bootstrap.block.Code;
import de.agilecoders.wicket.core.markup.html.bootstrap.button.BootstrapButton;
import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.form.DateTextField;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.form.DateTextFieldConfig;
import de.agilecoders.wicket.samples.components.basecss.DatePickerModal;
import org.apache.wicket.Component;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.joda.time.DateTime;
import org.wicketstuff.annotation.mount.MountPath;
When i import the sources which start with "de.agilecoder...." Eclipse says "The import de cannot be resolved"
How can i solve this problem?
I dont want to use wicket's default datepicker, because it is hard to pick birthday from it.
I hope, i can expres myself.
Thanks.
If you don't want to use Maven in your project, there are two things you can do:
Use Maven to build the Wicket Bootstrap project: Download the project archive file (like you already did), download Maven and run mvn package in the Wicket Bootstrap project directory with a pom.xml file. This will result in bunch of "jar" files (under "subproject-name/target" directory) which you can add as dependencies to your project.
Just go to the "bootstrap-extensions/src/main/java/de/agilecoders/wicket/extensions/markup/html/bootstrap/form" Direcotry, copy the "DateTextField.java" File to your project (in appropriate package "de.agilecoders.wicket.extensions.markup.html.bootstrap.form") and resolve all dependencies for this class in similar way. But this sounds like really hard work... You could also learn Maven in the same time ;)
Related
I am building a simple project using Ant (not Maven as I need the project to be build and distributed in an .msi package when it is finished), added all the dependencies according to this article (end even more poi jar files) to the classpath and still I am getting the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/math3/util/ArithmeticUtils
It seems that there are more dependencies that the poi-4.1.2.jar file does not contain. Can I add them by hand or will it require more dependencies after that? And where do I have to look. (org.apache.commons.*)
As said building this project with Maven is not an option.
Here are all the imports I have in my class that fails to compile:
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
And those are the jar files added to the Libraries in NetBeans
poi-4.1.2.jar
poi-excelant-4.1.2.jar
poi-ooxml-4.1.2.jar
poi-ooxml-schemas-4.1.2.jar
xmlbeans-3.1.0.jar
You can look on the website what dependency you need for general operations.
Still, for me it seems, that all the import-dependecy are correct. Maybe the dependencies are not correctly added?
Every dependency can be added per hand, even those you mentioned in your post. There are two options:
add the dependency via POM (this one I cannot tell in more detail)
in Projects Structure:
go to Modules, then Dependency. Here you can add any dependency vial MAVEN PROJECT library. In your case just write org.apache.poi in the search field, click the search button and look up the list of dependency you need. Here is a picture of the last step without the list, the screenshot did not allow it.
Also, it can even happen, that your setting in the project structure is not correct. When I did everything, the dependecies were added with the Scope of "Compile", like in the picture
I did the whole procedure in IntelliJ, but it should be quite the same in all other IDE's.
I am working on a Java fx application and I need to import some libraries from com.google.maps.
I imported these libraries :
import com.google.maps.GeoApiContext;
import com.google.maps.PlaceDetailsRequest;
import com.google.maps.PlacesApi;
import com.google.maps.QueryAutocompleteRequest;
import com.google.maps.errors.ApiException;
import com.google.maps.model.AddressComponent;
import com.google.maps.model.AddressComponentType;
import com.google.maps.model.AutocompletePrediction;
import com.google.maps.model.PlaceDetails;
The java import statement is a little bit misnamed, it really means alias. import com.google.maps.GeoApiContext; really just means: Any time you find the type GeoApiContext anywhere in this source file, assume I meant to write com.google.maps.GeoApiContext.
Crucially, it does not 'invoke' any code in that class whatsoever, nor does it find or download any dependencies from the internet for you.
You will need to find the jar(s) that provide these classes and put them on the classpath of this project.
It can be as simple as downloading the relevant jar (perhaps com.google.maps-google-maps-services.jar?), put it in a lib dir someplace inside this project, finding that in the package explorer, right clicking it, and selecting 'add to classpath'.
Or, more likely, you want to use gradle or maven to take care of this for you: These tools turn simply mentioning the dependency in a list of libraries you require into automatically finding that on the internet, downloading it, configuring your IDE so that it knows where it is, and using that dependency during build and run steps.
I am currently trying to make a web-scraping program with jsoup. However, everything I have imported does not seem to show up when I compile my program, and it errors out saying it can't find any objects that I reference from jsoup.
This is how I imported it:
`
import java.io.*;//for website
import java.net.URL;//retrieve url
import java.util.logging.Level;//log errors
import java.util.logging.Logger;
import java.io.*; //I/O stream
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jsoup.Jsoup;//web scraper
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.net.URL;`
And these are the types of errors I'm getting:
Images.java:25: error: cannot find symbol
for(Element el : img){// for each element, get source (src) url
Where Element from jsoup cannot be found.
This is my environment variable set up, since I thought that would have to do with it.
This issue is very weird to me, because I seem to be importing everything correctly. I also have the jsoup.jar and the extracted jsoup files in the root directory of my project, if that is the correct way to do it. I am using the java10SDK to compile through cmd, and I have have tried using intelliJ ultimate to use their dependency injection, but I can't seem to figure it out. I have also tried to compile with java7, I am not sure if it actually compiled with it with the method I tried.
Classpath image as requested:
You shoul add Maven support to your project, because it is the easiest way to manage all the dependencies. To do that you just need to select your project folder in IntelliJ from the Project Toolbar and select "Add Framework support" and then scroll down until you see "Maven".
Once you add Maven support to your project you just need to Enable Auto-imports, IntelliJ itself will display you a menu to select if you want to Enable them or not, you have to select Yes.
Finally, you need to add this block to the new file created in your project folder called pom.xml, just before the project block closes (< /project>):
<dependencies>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
</dependencies>
Once you do that, now you can import and use the JSOUP packages in your project. If you want to add more libraries, you can check out: https://mvnrepository.com/ and select the desired version of the library you want to install and copy&paste the dependency block on your Maven file.
As a tip, I highly recommend you to use a dependency manager (like Maven f.e.) for your projects and always add it once you create the project.
Hope it helps!
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
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.