Errors with importing Android project in eclipse - java

We had someone develop an Android app for us and although I have all his project files I cannot seem to get rid of the many warnings and errors that appear after import his project.
I am not a Java programmer nor have I ever used Eclipse, so I'm running pretty blind here, but I need to fix a couple of bugs that I at least managed to find in the code.
The developer saved his workspace as well as the Eclipse exe and all the jar files in a folder structure. What I have tried to so far is:
Copied all his Windows folder structure onto my Windows machine
Opened up the Kepler Eclipse exe in this folder structure
Set the workspace to the existing "Workspace" folder in this structure
Updated a bunch of .jar paths that were showing up as errors from his paths to my new paths (this resolved those errors)
Installed API 19 in the SDK manager (and selectved it) in order to get rid of android-19 errors
Added the Workspace default JRE in the Java Build Path section as there was none there and to try and get rid of the "Build path specifies execution environment J2SE-1.4. There are no JREs installed in the workspace that are strictly compatible with this environment." warning that I suspect is related to the over 200 resolve type errors I am getting.
I've searched the forums to no avail. Any guidance would be appreciated.

Related

libgdx gwt install error eclipse

I'm trying to make a libgdx Android project work (= build) on Eclipse. It's the project from the book "Libgdx Game Development" : I just opened the GDX set up GUI and created a project named "demo".
I get two errors about GWT in the "Problems" Tab, in the demo-html project :
The project was not built since its build path is incomplete. Cannot find the class file for com.google.gwt.core.client.EntryPoint. Fix the build path then try building this project
2.The type com.google.gwt.core.client.EntryPoint cannot be resolved. It is indirectly referenced from required .class files
I have GWT Designer for GPE, Google Plugin for Eclipse and SDKS installed in the plug-in tab (from the Help > Install new Software), so I have no idea why it doesn't work.
All the questions that had those error messages were resolved by downloading the plug-ins I quoted, but in my case, they are downloaded and installed (can't re-install them since it tells me it is already installed) and I hit also already checked for updates.
Thanks in advance.

Eclipse Android Project Java Buid Issue

Just installed Eclipse Luna on a new computer with Ubuntu 14.10.
Copied my workspace over.
My projects will not build. The Console continues to show "Java Problem."
For example one of the 500ish errors with Java Problem:
Animator cannot be resolved to a type DefaultClusterRenderer.java /library/src/com/google/maps/android/clustering/view line 882 Java Problem
And it says the same "Java Problem" for about 500 more lines.
I have:
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
as my java path and I also have a copy of the JRE folder with contents within the eclipse folder.
What am I leaving out? My projects were building fine on my old computer.
When importing a workspace into a new computer or version of Eclipse, make sure that your target build versions are the same as in your previous workspace. This project required the Google Play Services Library and a Google Maps Library. Both of which had been marked with a target build of a deprecated version of Android.
Right clicking properties on your project and then selecting Android will allow you to change the build target as needed.

Java Fatal Error: Unable to find package java.lang in classpath or bootclasspath

I'm getting this error
Error:java: Fatal Error: Unable to find package java.lang in classpath or bootclasspath
in IntelliJ when I try to build/compile any project. Something that should be stated here is that NetBeans, Eclipse and even the javac command line can compile, build, and execute the same project without errors. This is why I suspect that the problem lies with IntelliJ, all other IDEs work well.
In IntelliJ I already:
Restarted, reinstalled
Invalidate Caches / restarted
Deleted / readded the JDK in Project JDK
Deleted / readded the JDK in Platform Settings
Rebuild / recompile
In Windows I already:
Deleted / Reinstalled Java SDK
Deleted / Readded the JAVA_HOME, PATH and CLASSPATH on System Variables
Tried the above on User Variables
Deleted and reinstalled IntelliJ IDEA
I already seached for issues like this on the Internet, here on Stack Overflow I found:
Question #1 | Question #2 | Question #3 | Question #4 | Question #5
And 30+ sites, and tried every answer...
Here you can see my IntelliJ Project Structure the last time that I tried to build/compile
I was using Java 1.8 when I got this error, after some hours, I installed Java 1.7 and the project worked fine. Maybe IntelliJ doesn't support Java 1.8?
Anyway, it would be great if anyone knew a way to make Java 1.8 work with IntelliJ.
I just spent quite few hours on this and found a solution which might work for you as well. IntelliJ seems to have a bug which expects the JDK to be in a different directory than is specified. I followed these steps:
open intelliJ, click help -> show log in explorer
modify build-log/build-log.xml and change <priority value="info" /> to <priority value="debug" />, you may have to run the editor as an administrator
run the compilation which fails with "Error:java: Fatal Error: Unable to find..."
open build-log/build.log and search for rt.jar, you should find it in a block with a set of other JRE libraries and the directory which points to the file should be wrong
In my case the JDK is included in D:\Development\software\jdk1.8.0_20, while the log points to C:\Users\Vladimir\Development\software\jdk1.8.0_20
I fixed the issue by copying my JRE to the place which is expected in the log. And just like in your case this seems to only happen with JDK 1.8.
The problem comes from IntelliJ bug (existing at least in version 14).
It happens when your JDK directory is under the user profile directory. For example, JDK located in this directory (for Windows):
C:\Users\myuser\jdk1.8.0_20
will be stored in IntelliJ internal configuration (file 'jdk.table.xml') as:
$USER_HOME$\jdk1.8.0_20
But your %USER_PROFILE% environment variable could point at some other (non default) location. Then IntelliJ will look at the wrong directory.
Possible fix:
Install your JDK at different directory, which is outside your profile directory. Like:
C:\Programs\jdk1.8.0_20
Then register this JDK for use in your IntelliJ project settings.
I encountered this on Arch Linux 4.16.13 with IntelliJ 2018.1.4 after importing a Java project using Gradle. I made sure that there is a registered JDK in "Project Settings" -> "Project" but IntelliJ was unable to find the classes from the JDK, java.util.List for example.
The solution was to add a new JDK entry at the same path as the existing JDK (/usr/lib/jvm/java-8-openjdk in my case). This will cause IntelliJ to put the files under jre onto the classpath whereas with the old JDK entry, only the files under lib were on the classpath.
Had the same problem. Simple fix to others in case the other answers are complex.
Go to File -> Project Structure
Under Project SDK, choose new and add another JDK.
The default use in my case was 1.8 that was of build 181. I choose the 1.8.0_192 I had recently downloaded.
After applying, the project loads itself.
When I re-ran the test, it works!
If this problem occurs when importing a project in netbeans then try to create a new project then check the properties of your new created project and match those properties with the project that you imported in my case there was a difference between target of android package version.
From what I understood, debugging for hours, the problem is with the location where the jdk1.8 gets installed(/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home), instead of under System/Library).
So the following has to be done to fix in intellij
1. For an existing project, right click and select module settings, and SDK and add 1.8 as a version.
2. Using a terminal go to ~/Library/Preferences//options/. Remove the old JDK specific lines in jdk.table.xml. Update the default version in project.default.xml
Clean you project in intellij and build. It should use the new jdk and sync.

I have just installed android SDK updates and now my projects are full of errors

I recently just installed downloaded and installed some updates in the android sdk to get access to some features and now when I have restarted eclipse all the projects have errors!!
Theres a small error at the start of package and the only resolutions it suggests is reconfigure build path, here is a picture of the carnage. Does anyone know how I can resolve this?
If java.util is an offending import, you haven't got your JRE configured properly or either the build or the IDE are in a kind of corrupted state. Since you already used the Clean command I'm going for a more complex issue.
Check your project's configuration and make sure you're not still referencing your old Java implementation. If by installing updates you mean that you downloaded a new version, installed it and then deleted the one you've been using so far, then the IDE might not be finding the JRE system library your project has currently configured.
Try right clicking your project > Build Path > Configure build path, then check if your current JRE system library is unbound. If so, you'll have to configure it again on the Libraries tab by using Add Library > JRE System Library.

Java Advanced Imaging "PlanarImage" class not found

Let me start by saying I've recently inherited a Java application written using Eclipse. I'm new to this language/IDE, but I have a lot of experience with C# and Visual Studio. So, my problem may be something very silly, but I have a foundation so I'm not a total programming newb.
I'm exporting this project as a runnable JAR, using a launch configuration provided by the original developer. I have tried this with both "Extract required libraries into generated JAR" and "Package required libraries into generated JAR". Either way, I get the following error when I launch the application:
java.lang.NoClassDefFoundError: javax/media/jai/PlanarImage
I launch the application using this command, where appName.properties is a properties file that's required for running the app:
java -jar appName.jar appName.properties
This occurs multiple times from separate stack traces. I'm not seeing any other runtime errors or compile errors. My JRE system library is jre1.5.0_05. I installed JAI by downloading jai-1_1_3-lib-windows-i586-jre.exe from http://download.java.net/media/jai/builds/release/1_1_3/ and installing it into the jre5 directory. My project did not compile until I got this specific version of java, and installed the JAI jre into that version's folder, so I am fairly certain I have that part together correctly.
Finally, here is my classpath:
C:\Program Files (x86)\Java\jre1.5.0_05\lib\ext\jai_codec.jar;C:\Program Files (x86)\Java\jre1.5.0_05\lib\ext\jai_core.jar;C:\Program Files (x86)\junit4.10\junit-4.10.jar;.
Is there anything obvious I'm doing wrong here? Is there any other information that would be helpful in figuring out why I'm getting this error?
Make sure the jar is in your classpath. Are you running from an IDE or from command line?

Categories

Resources