Google OR-Tools: Using in an IDE - java

I have the Problem that i want to add OR-Tools into my project via eclipse IDE. I want to use the Linear Solver. I added the two jars form the downloaded Zip file. Now i want to run the SimpleLpExample from the OR-Tools site. I've got the Error that no jniortools in java.library.path. I see that at other posts they say you have to run make third_party and make java, but i don't know where i have to run these commands.
When somebody added it successfully into an IDE it would be glade when this person can explain how he does it. Thanks for help.

No. You need to add the path to the jniortools shared library I'm eclipse.
All dynamic libraries are located in the lib/ directory of the extracted archive.
To add the correct path, please follow these instructions:

Related

Installation of metadata-extractor

I'm stuck on installation.
I downloaded Maven, but I'm not sure which file within
the metadata-extractor folder (that I downloaded from the repo) to use as the target.
I tried all the files at the top level.
All attempts have failed, e.g.
java -jar metadata-extractor-2.13.0.jar build.gradle
com.drew.imaging.ImageProcessingException: File format could not be determined
I am using v2.13.0 of the meta-data extractor
I've just started to code and took interest in this project but also had issues using it. Instead of using Maven i just downloaded the source code from github and threw the 'com' folder into my myproject/src folder. Then i downloaded the xmpcore-6.1.10.jar library and added it to the Build Path. Got it working that way. I hope someone will give you a better solution but if you just wanna do something right away, you can try this solution.
Try downloading IntelliJ and create a "new project from version controll". Use the URL given on the GitHub page (under download/code). That will save you a lot of problems.

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.

Adding External jar copy to Project

I created a project but I am using an external library for it. enter link description here
I added the library to my Beans as follows:
Right click on folder "Libraries"
Add Library
Create...
Gave it a name "gson 2.7"
Picked the class, source and javadoc files.
I went on and continued programming and then I added my code to Github. Then when I cloned it my Library was missing.
How can I fix this ? How can I make it dynamic so I dont have to worry about this anymore. In other words I need to add the library to my code and not just the reference.
Thanks a lot for the help
Just upload a copy of your library to github.
I have not used netbeans, but from what I understand it adds the jar somewhere outside of your project directory, and it simply adds the location of the jar to your classpath. When you upload and then clone the project from github, the jars are not uploaded/cloned, and the project structure metadata for your project is also lost from netbeans.
My suggestion is to learn and start using a build tool like maven. It takes up the responsibility of adding your dependency libraries everytime, given that you have an internet connection. It also adds the libs to the target directory of your project folder, so you probably will need the internet connection only once. The libs will be uploaded and cloned back from the github repo everytime.
IDEs like eclipse have inbuilt support for maven, so you don't even have to worry about executing the mvn commands. Here's a tutorial that will get you intrigued - with the IDE that you prefer.
https://platform.netbeans.org/tutorials/nbm-maven-quickstart.html
Thanks a lot for all the replies and comments.
Technically there are two approaches to my problem. For this articular example I chose to copy the external jar files to my project.
1. Copy jar files to your project.
Go to project properties
Under Libraries folder make sure to set up a libraries folder by following the steps.
Add Library at the bottom ( you can create or import; since I already had gson in Netbeans I just imported it.)
Press ok to confirm and you are done!
2. Use Maven
Go to plugings and make sure you have all Maven plugins installed, if not do so.
Create an new project and choose maven/java application
Follow the prompts
At this point you can start coding (in my case I just imported my class files from the other project)
Right click in "Dependencies folder and then "Add Dependency"
Under query type the repository you are looking for; in my case "com.google.code.gson : gson : 2.7"
Click add and you are done!
Thanks a lot to everyone for the help :)

How to set a classpath automatically during the installation of an excutable java application?

I am writing down an example of what I was trying to do.
But this is just one example, I am sure there would be many. So I want a generalised answer for this.
I was trying to make a java desktop application which reads the word documents. I realized I need some Apache libraries/APIs that would help me do it.
So I downloaded the library.
But now I need to set the classpath of the files from the library.
I am a developer and I can do it, but imagine giving such instructions of setting a classpath to a complete non-developer user.
I was wondering if when I am over with the making of this java application, I would make it executable (exe) application and when someone installs it, the classpaths are set automatically during the installation and the apache library files are automatically extracted.
How can I do it? Can someone explain me in detail - step-by-step?
Please consider using some development IDE, like (free) eclipse for instance.
Then crate new folder (clled lib for example) in your project, copy the library into it,
then click on your library by the right button and select "add to build path"
As already mentioned - best way to do it is to use Manifest file in your jar. Official documentation: https://docs.oracle.com/javase/tutorial/deployment/jar/downman.html

How do I use API's in Netbeans for JAVA?

Ok so there are tonnes of API's out there. I need to use some of them like JIntellitype, iText, docx4j etc. But the problem is I do not know how to go about it in Netbeans.
I tried following the instructions in readme for all these API's but it does not work since there is something I am doing wrong. I am a newbie at JAVA and Netbeans.
Thanks!
[Update]
This is what I tried to do.
I downloaded the JIntellitype API. It contains lots of files including JAR,DLL,CPP etc. When viewed through File->Open Project from Netbeans this folder is displayed as a project.
I created a new JAVA Application project from Netbeans.
I right clicked the Project->Properties->Library and added the API folder there.
Then I tried importing one of the classes from the API called HotkeyListener as follows:
import jintellitype.HotkeyListener;
I received an error saying package does not exist.
Generally you have to add your API jar to your project. Open project properties, find where external libraries are added and add them. Once you are done you can import library classes and use them.
like AlexR said, you should add the jar file with the jintellitype.HotkeyListener in it, not just the directory. You can open jar files with winrar, winzip, 7zip etc...
Regards

Categories

Resources