Is it possible to use java SE library in J2me? - java

is it possible for me to use java library such as
import java.io.File;
import java.io.FileInputStream;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.HashMap;
in my j2me project?

Short answer: No.
Long answer: You can try to add the jars as third party libraries, but you may find conflicts. More important, when you finally deploy in the target system, you may find that these libraries do not work with that JVM.

Related

Cannot find java.nio.file.Files

i need to import java.nio.file.* but cannot find the jar containing this package
I installed new version of jdk 1.8 but still i cannot import this package .Can anybody tell me the jar file containing this package.
Thanks
I think the package want you to import is java input output.
Used this
import java.io.file.*;
Instead of
import java.nio.file.*;

Eclipse: Java application size

So i made it finally to the final stage of my simple java app that runs under windows and is used to get the user name and log it in an remote excel file. up until now everything is ok.
When i Externelize (does that word exist?) the app to make it a runnable jar the size of the app was 22Mo! wich is huge since i want to use it in an email (outlook).
Here come the question (finally). Can i delete any of the default java jars in the classpath and the app will still run ?? if yes, which ones??
NB: i tried including the imports in the SS if it does help
NB2: the Jar of the app it self is just 20Ko , the ressources are around 22Mo .
By the way thank you all for helping me make this app it was thanks to this website eventhought i didn't ask any question up until now you'll still answered them all..You rock !
Those are my imports:
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.wb.swt.SWTResourceManager;
EDIT: So after the discussions i managed to reduce the size of the app to 8Mo by deleting some of the jar in the referenced library (org.ibm.icu.jar). The app still runs perfectly without it
A jar file is just a zip file, so what I would do is simply unzip the file and see what comes with it and what is large. The standard java libraries, should not even be part of your JAR as they are part of the JRE.
However, my suspicion is that you use Apache POI and that is huge. So if you are writing to an Excel file you might have to stick with that size or find another library.
You could for example write the output as CSV which is very lightweight.

jar files used for the below imports

Anyone used these imports in your files...?
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.params.HttpMethodParams;
I have an example that uses these imports. I have commons-codec-1.6.jar/httpclient-4.1.2.jar/httpcore-4.1.2.jar/commons-logging.jar in my classpath. Still the import fails. any inputs?
That's Apache commons-httpclient. And the Javadocs for that library.

Java Class PPM, PPMImage not found, where to get JAR Files

I need help and wanted to ask if somebody knows where to get the JAR Files for my system library (eclipse helios), cause I need to use those classes PPM and PPMImage but the import declarations seem not to work
package com.sun.media.imageio.plugins.pnm;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.io.*;
import java.lang.*;
import com.apple.*;
import de.medieninf.ads.*;
this is what I have implemented so far
I googled this hard but couldnt find anything.
You need to install Java Advanced Image and its plugin Java Advanced Image I/O Tools: JAI 1.1.3 and JAI I/O Tools 1.1
These provide you the PNM plugins are trying to use.

I have downloaded geotools . In which eclipse directory should I put it in for it to be fetched by my java file?

package geotools.data.geojson;
import jts.geom.Coordinate;
import jts.geom.CoordinateSequence;
import jts.geom.Envelope;
import jts.geom.Geometry;
import jts.geom.GeometryCollection;
import jts.geom.LineString;
import jts.geom.MultiLineString;
import jts.geom.MultiPoint;
import jts.geom.MultiPolygon;
import jts.geom.Point;
import jts.geom.Polygon;
import jts.geom.impl.CoordinateArraySequence;
So where should jts and geotools go into for me to be able to access them ?
There is an eclipse quickstart that answers your question; it provides instructions for both use of maven (which is more automatic); and for downloading the jars into a usable eclipse project.
http://docs.geotools.org/latest/userguide/tutorial/quickstart/eclipse.html
The eclipse download includes JTS (and other support libraries as needed).
It should be added to the project's build-path if it's a JAR file.

Categories