Strange GWT exceptions in Designer - java

I've started encountering some weird exceptions trying to use the GWT designer. I'm on Ubuntu if it matters, GWT 2.4.0, Java 1.6.0_20 x64
When I use the designer, a previously used DisclosurePanel shows up in a pink box indicating. When viewing the details, it indicates a NoClassDefFound error. This makes no sense because in the code editor, the class is visible and compiles without error.
Secondly, I am unable to drop a CellTable instance on the designer. Even with the most basic T = java.lang.Object, the error comes back indicating an IllegalArgumentException : "Unable to find 'columns' in class com.google.gwt.user.client.UI.HTML.
This was working yesterday with the designer, but all of a sudden has entered the crapper. I tried reinstalling the GWT plugins, and even using a new eclipse install with fresh GWT plugins installed, but to no avail. Does anyone know the source of these errors and how to remedy them?

Alright, it seems that the other day I synced up my build machine for the fisrt time and had a different version of java installed on my dev machine. OpenJDK 1.6.0_20 (Iced Tea 1.9), vs Java SE 1.6.0_35.
Since this java was in my /usr/bin which was earlier in my PATH envi var than my 1.6.0_35 build that was at the end of the PATH, it was using hte older 0_20 version. I'm guessing the GWT designer was built with something closer to 1.6.0_35 than 1.6.0_20, and was causing conflicts as implied here.:
Start by checking your Eclipse ".log" file (found in your /.metadata directory). If the error references one of your classes or methods, check that your classpath properly references the class you are trying to use. Also check that your class is properly compiled (no red X's) and that a .class file exists in your projects /bin directory. A mismatch between the JDK used to compile your code and the JVM used to run Eclipse can also manifest itself as a NoClassDefFoundError problem. For example, if you compile your code using JDK 1.5 or 1.6 and then run your Eclipse using a 1.4 or 1.5 JVM, you can have this problem. If the error refers to a custom widget, you should also check that your component does not trigger an exception during its initialization (which can manifest itself as a NoClassDefFoundError). Try refreshing and cleaning your project using the Project > Clean... or Project > Build Project commands. If that does not help, send a test case to support.

Related

Why are my Java Projects in Eclipse giving an error on creation? [duplicate]

In a workspace with several projects, I see correctly all the text markup in all files except one, where there is only the markup for specifiers, types and strings.
What I have already tried:
Check if the file is opened with the text editor instead of the Java editor. It's not. The file is opened with the Java Editor.
Restart Eclipse.
Clean the project.
The problem persists.
The problem:
What I expect:
Any help will be highly appreciated and voted.
The Error Log view shows that you use a JRE from Eclipse JustJ to run your Eclipse.
The problem is that you have a minimal instead of a complete JDK installed.
Alternatively, you can specify the Java 11 or higher VM in the eclipse.ini to run Eclipse.
The JustJ OpenJDK Hotspot JRE Minimal (Stripped) is sufficient to run the Eclipse Installer and the Eclipse platform, but not to run the Eclipse Java IDE you have without errors.
Minimal means that only those system library modules are included that are required by the Eclipse platform and Complete means the full system library.

Can't integrate SWT with JavaFX under "Zulu" JDK 11

We want to use both SWT and JavaFX in an Eclipse plugin within our RCP application. Unfortunately, we're experiencing problems integrating SWT with JavaFX under Java 11. The build environment uses e(fx)clipse 3.5. We're developing against the Community edition of Azul Systems' "Zulu" JDK 11, bundled with Azul's version of OpenJFX.
Formerly, we developed under Java 8. At that point, our build used a compile-time class path referring to jfxswt.jar, which lived in the jre/lib directory of the JDK. We didn't use any special class path settings at run-time.
We are now trying to move to Java 11. There, this JAR has become javafx-swt.jar and lives in the lib directory of the JDK. It no longer seems to be enough to set the class path to refer to this JAR at compile time: it seems to be necessary to do so at run time too. If we don't do this, we get an error (java.lang.NoClassDefFoundError: javafx/embed/swt/FXCanvas).
As a test, we experimentally embedded javafx-swt.jar within the JAR implementing our Eclipse plugin. We then referred to it in that plugin's .classpath file, and the code worked as expected. Unfortunately, we can't embed the JAR this way for legal and other reasons.
A note on Java modules: javafx.swt does not show up in the output when we issue the --list-module command. We tried running the application using parameters -p /path/to/JDK/lib/javafx-swt.jar --add-modules javafx.swt, but this doesn't seem to solve the problem.
My question: Is there a way to set up the class or module path to allow our Eclipse plugin to find this library in the JRE? Any solution would have to work with whatever JRE the code happens to be run against (I think it is all right to assume lib/javafx-swt.jar will live in that JRE).
Would it help to use a separately-downloaded version of OpenJFX rather than the copy of OpenJFX in our JDK?
Very many thanks ☺

Java Compilation Errors: Unsupported Class Version

I recently finished a project in Eclipse and it ran without a problem. Then recently I imported a new assignment to work on for class, but when I did my old project all of a sudden had a x on its icon. I looked through the code, nothing had been changed, but it threw this error in the console:
java.lang.UnsupportedClassVersionError
at java.lang.ClassLoader.defineClass1(Native Method)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:685)
And others. Is this possibly due to the version of java being used or something else?
An UnsupportedClassVersionError is thrown when you use a higher JDK version to compile than when you try to run the program. For example, you compile Program.java using JDK1.7 but then attempt to run using JDK1.6. I am guessing that upon importing the new assignment for your class, you unknowingly adopted to use the JDK that the imported project was compiled in.
I suggest going to Eclipse Preferences and taking a look at your installed JRE's to make sure everything is okay and also to look at the projects Properties and looking at its Build Path. In general, make you you are using a version to run in that is at LEAST what you used to compile it. If you chose a higher version everything will still be okay.
EDIT:
Here is a link for more information on the matter and where I had originally read about this. I knew I had saved the link somewhere.
http://javarevisited.blogspot.com/2011/07/javalangunsupportedclassversionerror.html

Android ADK error: There are no JREs installed in the workspace that are strictly compatible with this environment

I seem to have solved the immediate compile errors, but would appreciate some deeper insight and have not found anything on StackExchange or Googling the error message that appears directly applicable.
Have been using Android Development Kit plugin for Eclipse for only a few weeks now. I understand that Android only uses syntax through Java 1.5 and suspect that may be a clue to my problem which only occurred after I added a Debug.startMethodTracing("filename.trace"); and added WRITE_EXTERNAL_STORAGE uses-permissions.
Successfully compiled and ran simple (hello world style) apps, then all of a sudden: bam!!
Brand new error message:
"Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment."
When I checked the Java Build path for my app:
Right click project name > Properties > Java Build Path > Libraries
There were only four items:
1) An imported jar file library (for an API)
2) Android 4.4.2
3) Android Dependencies
4) Android Private Libraries
I seem to have solved the problem by following these non-Android specific instructions:
Java Build Path
which essentially said to:
'Add Library" > 'JRE System Library" > "Workspace default JRE (jre7)
and now my code appears to be compiling again. However, I am somewhat uncomfortable with my level of understanding of why it was necessary to do this (I just checked and Jdk1.7 is still in my system path and seemed to work fine before). Is this usually necessary when developing for Android?
In other words, is it normal for a JRE to be explicitly listed in the libraries section with the ADK?
Is there any problem with using JRE 1.7 instead of an older version?
I also read these instructions, but again, the answer is not specific to Android:
Warning - Build path specifies execution environment J2SE-1.4
The warning is letting you know that you don't have any actual 1.6-version JDKs available, even though your code is set to a 1.6 compliance level. The practical pitfall is that since the only JRE runtime available is the 1.7 runtime, you might use some class or method that was added in 1.7: Your code would still compile just fine, but then you'd get a NoSuchMethodError or such if it was run on a 1.6 runtime.
In practical terms, since you're targeting Android, you probably don't need to worry; the ADK is going to recompile your code anyway, and any such errors should show up immediately. If you do want the warning gone, just install the 1.6 JDK alongside the 1.7.

Setup eclipse java SE-1.7

I wanted to start learning java but Eclipse is giving me some trouble.
First of all I'm a beginner with Java with little to no knowledge about it. I want to use 'JavaSe-1.7'. I have no clear reason to use it besides using the latest version. After downloading Eclipse (Eclipse IDE for Java Developers) I created a new Java project and selected 'use an execution eviorment JRE : JavaSE-1.7'. This directly popped the notification saying 'The default compiler compliance level for the current workspace is 1.6. The new project will use a project specific compiler compliance level of 1.7.'. I finished creating the project and started following some tutorials.
However I noticed directly I have 2 errors which dont explain anything or have a source. I ignored it and started typing and tried to import 'java.io.console' however it said 'The import java.io cannot be resolved' and I have no idea what is the cause of it neither how to fix this.
Would like some instructions into the right direction.
Thanks in advance
Check your Eclipse preferences: Java -> Installed JREs. The one that you're using should be marked and it should be a JDK not just a JRE.
Also check your project's build path: Right click on the project -> Properties -> Java Build Path
Check in the "libraries" folder whether the JRE System Library is present and if not add it using "Add library"->"JRE System Library" and then select the correct one (from an installed JDK).
You may not have your JDK/JRE set up correctly.
Check the following:
Did you install a JDK or just the JSE? The JDK is needed to compile .java files to .class files. Without it, you can only run java programs, not develop them. If not, download and install it from Oracle website.
Check in Eclipse, if you have the JRE installed there as well. You just need to specify the path to the installation. You can reach this screen via the "Window->Prefrences" menu. see this screenshot:
The message you receive about project specific compiler compliance level is not a problem, it just means that your workspace is set up to comply to java 1.6 but your project will comply to java 1.7 standards. Also, Java 7 in general is no problem whatsoever.
Paths may differ, especially if you're not running a *nix OS. Just point the location to where you installed your JDK.

Categories

Resources