I'm having a problem with the MinGW implementation of GCJ. I read that you have to install libiconv before you can use it. However, the documentation wasn't very specific, and it did not say where to extract the binaries and developer files (libiconv-bin and libiconv-lib). I have tried the following paths:
$p = c:\mingw
$p\libiconv-1.9.2-1-[bin|lib]\
$p\libiconv-[bin|lib]\
$p\mingw32\libiconv-1.9.2-1-[bin|lib]
$p\mingw32[bin|lib]\libiconv
$p\mingw[bin|lib]\liconv
$p\bin\libiconv-1.9.2-1-[bin|lib]
$p\bin\libiconv-[bin|lib]
None of these work. Any help on where I'm supposed to put the libiconv files?
Extract the libiconv-* into the same directory as MinGW.
You can extract the libiconv-* into a folder first, then copy all the sub-folders in to your MinGW directory.
Related
I'm starting a Java programming class at UCSD next week and I'm trying to prepare over the weekend. There is a library called objectdraw.jar which comes with the book we will be using for our class projects. I am currently using Vim for my Java projects because most assignments will be simple and I am still trying to learn and master Vim.
Now to the question:
In C++ I am able to use #include with angled brackets <> to include headers in a default folder and #include with quotes "" to include local header files. It seems from what I've found with some Internet searches that you can't do that with Java.
I tried putting the objectdraw.jar file in the same folder as my .java file for the first assignment, but it doesn't find the library using the following code:
import java.awt.*;
import objectdraw.*;
When I searched online, the Gentoo HOWTO mentioned setting a CLASSPATH but then mentions that those instructions should be considered deprecated, but doesn't provide further instructions.
The website where I downloaded the library http://eventfuljava.cs.williams.edu/library.html does not provide instructions for Vim, but does for other IDEs like Eclipse and Netbeans.
Can anyone tell me where I would place the .jar file to ALL my projects can find it, or can anyone point me to a resource where I might find an answer. I seem to be asking the wrong questions when searching online.
Thanks!
Look here for how to set classpath using command line options to any of the java sdk tools - java, javac. The page shows how to set the environment variable CLASSPATH as well as how to use the switch -classpath.
In your case if you have the objectdraw.jar in the same directory as your source files, then you will need a command like this to compile -
javac -classpath . MyClass.java
and this to run
java -classpath . MyClass
You can also provide the full path to a jar file in the classpath and add multiple directories and jars. Such as -classpath .:/path/to/my.jar:/some/other/directory note paths and separators for *nix environment. on Windows it would be ; and \
Edit: Note comment below for quoting paths with spaces in them.
How do I connect to the gdal eclipse. I tried all the ways it does not work.
How do I connect to the gdal eclipse. I tried all the ways it does not work.
All the time issue
java.lang.UnsatisfiedLinkError: D: \ Document \ JAVA \ Gdal \ gdalLibrary \ gdaljni.dll: Can't find dependent libraries
I also have this problem and just found a solution. I am working with WIN8, and downloaded release-1600-gdal-1-8-0-mapserver-5-6-6.zip. As in the readme txt, I run the SDKShell.bat to set the environment. Then I include the jar and the four jni dlls in the java folder into my testing java project. There was always error like gdaljni.dll: Can't find dependent libraries. Then I figured out the settings in the bat may not been successfully done. I opened up the bat with an editor and found all the necessary enviroment settings and did it one by one. Then the java project worked with no problem. The settings needed are as follows:
SET PATH=%CD%\bin;%CD%\bin\proj\apps;%CD%\bin\gdal\apps;%CD%\bin\ms\apps;%PATH%
SET GDAL_DATA=%CD%\bin\gdal-data
SET GDAL_DRIVER_PATH=%CD%\bin\gdal\plugins
SET PROJ_LIB=%CD%\bin\proj\SHARE
For the PATH you can just in explorer right click on computer-properties-advanced system settings-Change enviroment variables. Add the absolute paths(%CD% means the current folder of the bat file, in my case is C:\GDAL, so path "%CD%\bin" should be changed into "C:\GDAL\bin") of "SET PATH line" to your PATH. For the other three lines of settings, just add three system variable for each and aslo change the path containing %CD% into abousolute paths. Then, everything should be ok. Note I omitted some paths in the bat file which I do not need for my java bindings. You can also add them to PATH if you want to do use gdal with other languages. I guess the most common mistake is forgetting to add the GDAL_DRIVER_PATH and PROJ_LIB.Hope it may be helpful for the others who have such issue.
If UnsatisfiedLinkError: gdaljni.dll: Can't find dependent libraries occurs...
Check the path of GDAL libraries, data and plugins (they must be in the installation path of your application)
Missing VC++2010 runtime (if GDAL is compiled using VC++2010): download the Microsoft Visual C++ 2010 Redistributable Package:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84
You may need to set following in the Windows system environment variables:
GDAL_DATA=<path to gdal-data folder>
GDAL_DRIVER=<path to your gdal\plugins folder>
This might help you:
1) set path as said above
2) Put the *jni.dll files in the 'The path where you installed gdal'\gdallib\bin\gdal\java\ directories into the jre\bin directories that you are using. (This saved me!)
Hope it will be helpful:)
Hey, this question links into another post I made today: Reading the first 10 bytes of a file in Java
Having been told that my solution could involve the apache commons codec library, I've tried to figure out where the file needs to be placed and am seriously not getting it. Can't find anything online that simply says 'It goes here...' so maybe someone on here can help?
I've got Windows 7, I'm using JCreator and have the 'jre6' and 'jdk1.6.0_23' folders in my Program Files/Java folder
Any help at all would be appreciated so please let me know :)
Thanks :D
You need to reference the jar file (not the containing directory) via your class path (a list of directories and .jar files)
e.g. from a command line:
$ java -cp {complete path to jar file} YourClass
Alternatively you can set the CLASSPATH environment variable.
See here for more details.
You may also specified globally CLASSPATH environment variable i.e:
unix:
export CLASSPATH=/path/to/jar1.jar:/path/to/jar2.jar: ...
windows:
set CLASSPATH=c:/path/to/jar1.jar;c:/path/to/jar2.jar
Remember on windows classpath separator is ";" and on unix/linux it is ":".
It is also correct for -cp option mentioned in previous answer by Brian
Well, I guess subject says it all :)
The ideal solution would find all jars within a certain folder (they might be in sub-folders), and write all the sources found into a single "src" directory, of course maintaing the package folders.
Concrete use case: decompile all Eclipse plugin jars
Download JAD Decompiler.
Unjar all your jar files (using the command jar xvf) to some directory. Let's call this ${unjar.dir}.
Create a directory for JAD to write out the decompiled sources. Let's call this ${target.dir}.
Execute the following command:
jad -o -r -sjava -d${target.dir} ${unjar.dir}/**/*.class
options are:
-o - overwrite output files without confirmation
-r - restore package directory structure
-s <ext> - output file extension (default: .jad)
http://java.decompiler.free.fr/
Decompile eclipse plugins??
Apart from the existence of a technical solution - (1) you can get all source files for the (official) eclipse plugins as bundles and (2) don't expect that the decompiler results will compile or can be used to debug the code.
So if you want to study the source of eclipse and it's plugins, decompiling is .. say .. not the best idea.
I wrote a tool names code-collection using shell script and cfr to find and decompile all jar, war files at once.
After decompiling jar, war files, you could use my tool to find and copy all specific files (.js, .html for example) to a new directory.
Visit my project at: code-collection
The Windows equivalent command for this would be:
jad -o -r -sjava -d "target.dir" "unjar.dir/**/*.class"
this will sound silly but i am executing my code from command prompt and have to use a jar in my class.
I have placed my jar in lib folder of JDK..
but i am still getting error of file not found
any explanation??
EDITED : guys tried all but still not working
EDIT 2 :i am trying to work as was told by this link i am using js-1.6R5.jar
Edit 3 : i undestand all the things you ppl have told but nothing working for me.. pls give me a link to upload my example that i can share with you all.
Edit 4 : i am fed up by setting classpaths but its not working... i have SDK installed in my system, do i need an extra JDK to run my programs from command prompt??
You need to add the jar to the class path by doing the following...
java -classpath D:\myprogram;D:\myprogram\lib\supportLib.jar org.mypackage.HelloWorld
Please see Wikipedia - Classpath_(Java)
You can place it anywhere, as long is you include it in your classpath. See Setting the Class Path for how to include jars in the classpath.
Have in mind that adding something in the JDK lib is almost never a good idea.
You can make a lib folder in your application's directory and put jar files there, then make your application find them by adding lib to your application's classpath.
And, don't put your jar files in JDK's lib folder. It's not good practise.
You need to let Java know that you want to include the jar in your classpath (the list of folders and jars it checks for classes). One way to do this is with the -cp command line argument, something like
java -cp ".;pathToMyJar\myJar.jar" MyClass
Another is to edit the CLASSPATH environment variable in your OS to include your jar.
A simple solution will be to place the jar fiel inside the windows folder if you are doing it in a Windows machine.
Unfortunately your question contains a lot of question signs and few information.
If you are using java.io.File to open jar as a regular file this jar should not be in lib directory. You just have to provide correct path in file system.
If however you are just trying to use jar as a part of your application it should be in classpath. Use either command line java -cp myjar.jar MyMainClassor put full path to this jar to global environment variableCLASSPATH`.