Java missing libraries - java

I'm using Eclipse on Mac OS X 10.6.6.
For some reason when I'm trying to import the following libraries I get this error:-
java.apt (only java.apt.font is available)
javax.swing
The system is fully updated with the recent updates
Thanks in advance

Are you doing
import javax.swing;
or are you doing
import javax.swing.*;
The difference is very important.
As a general rule, I try to import only the exact classes I need.

Related

Buildozer, How to add external python packages?

I have built a kivy app using Python 2.7. I have used the import statements
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.widget import Widget
from kivy.properties import *
from kivy.uix.textinput import TextInput
from kivy.uix.image import Image
from kivy.uix.image import AsyncImage
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy import Config
import sqlite3
import webbrowser
from kivy.lang import Builder
import re
from bs4 import BeautifulSoup
import unicodedata
from threading import Thread
import requests`
In my Buildozer.spec file
requirements = kivy,requests,bs4
I have set the requirements to use these, as the rest of the packages are inbuilt in Python. I did not specify them. The APK Gets built and I run it on my android phone and the app crashes without any error. I dont understand where the problem lies. If it is my buildozer spec requirements or improper usage of packages.
I have been searching all over the internet , and I have read the Buildozer docs, But I haven't been able to find a good tutorial on how to use Buildozer . I am using it on Linux. Can someone explain what is going wrong?
I have been having the same problem. I've narrowed it down to the bs4 library, at the moment i havent got to the bottom of it but i think it is something to do with mixing python 2.7 ans python 3. Anyway the first link is to my (so far) unsolved question.
Kivy App build with Buildozer. APK crash
The following link is to a set of instructions that may help you find your problem.
adb install instructions:-
http://lifehacker.com/the-easiest-way-to-install-androids-adb-and-fastboot-to-1586992378
adb logcat fault finding:-
adb logcat hangs with "waiting for device" message
Hope this helps.

UnsatisfiedLinkError while executing new Mat()

i am currently trying to code a little program to take picture of newly students and save them by their names etc to ease the inscriptions things etc.
So here is my problem, i found a great tutorial to help me using a webcam:
http://www.codeproject.com/Tips/717283/How-to-use-OpenCV-with-Java-under-NetBeans-IDE
I can run this project with no error but when i try to import some code to mine i got this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat()J
at org.opencv.core.Mat.n_Mat(Native Method)
at org.opencv.core.Mat.<init>(Mat.java:24)
at recupphoto.Ihm.<init>(Ihm.java:38)
at recupphoto.RecupPhoto.main(RecupPhoto.java:19)
Java Result: 1
The error occurs when i execute theses lines:
Mat frame = new Mat();
MatOfByte mem = new MatOfByte();
Here are my imports in case it could help to find out:
import java.util.ArrayList;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import org.opencv.core.Mat;
import org.opencv.core.MatOfByte;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.videoio.VideoCapture;
While compilation i got this message, dunno if related or so
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Both error appears (i guess) when Mat() is called but i cannot find how to fix this.
I should really use some helps or tips here! Thanks for reading this and sorry for my bad english!
Finaly solved my problem, the fact was that i called
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
too late, so i moved it a bit and solved that :) Thanks for all who spend a bit of their time to help me there!
Step 1 Get dependency walker application.
Step 2 Browse into the relevant library folder.
Step 3 See what's missing and get it.
Tips:
Make sure You get DLL's for your architecture either 32bit or 64bit.
Make sure to compile with proper java (32bit/64bit) depending on which DLL's you provide.
Lastly if the dependencies you are missing start with MSVCP***.dll download Microsoft Visual C++ Packages. Again care for the architecture. I recommend you start with this step.

Importing javax package in Java without an IDE

I'm developing a project in Java using Vim, and I need to use some classes from the javax package. What should I install and configure to be able to import any of them?
I already installed the JDK 7 and also put it as my default using update-alternative command.
For example, when I compile a class (for example one called GUI) that uses the javax package, the compiler displays:
> javac GUI.java
GUI.java:1: error: package javax does not exists
import javax.swing;
^
1 error
I think it is related to the $CLASSPATH environment variable, but I'm not sure how to tell the compiler where the package is (since it is inside the JDK 7).
Instead of trying to import javax.swing, which does not actually specify anything specific, you should import javax.swing.*. This imports everything in the javax.swing package.
import javax.swing.*;
You can also import specific swing components and utilities:
import javax.swing.JButton;
See The Java Tutorials page on Using Package Members for more information about importing package members.
You should be importing as:
import javax.swing.*;
or else for example
import javax.swing.JFrame;

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.

import chat.server not found

When I develop an RMI server, I use:
import java.rmi.server.UnicastRemoteServer;
import java.rmi.server.StubSecurityManager;
import chat.server.*;
But when I compile the Java file, an error occurs that says:
Class java.rmi.server.UnicastRemoteServer not found in import. import
java.rmi.server.UnicastRemoteServer
and also error with StubSecurityManager. Please help me work out this problem.
It appears that you are using an old code written in JDK1.1 trying to compile using newer version of JDK.
You need to make following changes.
java.rmi.server.UnicastRemoteServer -> java.rmi.server.UnicastRemoteObject
java.rmi.server.StubSecurityManager -> java.rmi.RMISecurityManager
Source:
http://groups.google.com/group/comp.lang.java.api/browse_thread/thread/c768d6617f80eedd/4edf4acebd2ce575

Categories