Groovy, Grails & Eclipse/STS - Bad Version Number - java

I have a clean, vanilla system (Mac OS 1.5) with Java 6 installed - I have also installed the latest version of Grails (2.0.0.RC3) and STS (2.8.1), together with appropriate extensions:
Grails Support
Groovy 1.8 Compiler
Within STS I have navigated to Peferences -> Groovy -> Compiler and changed it to use version 1.8 compiler (rather than 1.7).
I have then created a blank Grails project from the command-line (using "grails create-app", etc) and everything works fine - I can compile/test/run it.
However, when I access the problem via STS/Eclipse I get a Bad version number being reported on conf/ApplicationResources.groovy; nevertheless, the project still works - I can still compile and run from within STS, but the auto-build feature keeps kicking in and reporting the same compilation problem on this file...
Can anyone shed any light on why this might be and how to solve it?
I have done various clean operations, such as "grails clean" and removed the ~/.grails and ~/.groovy directories in case of a stale class file, but it's made no difference so far...
Any help much appreciated!

It seems my answer to Eclipse problems (not specific to STS) was usually do clean install. You likely have already heard this and perhaps I should not post as an 'answer' (I'm new to stackoverflow) but my team uses IntelliJ IDEA across the board. Some start with STS for familiarity but eventually that gets overridden by IntelliJ's Grails support. It is worth giving it a try over Christmas break. You can try the Ultimate edition (has Grails support) for free for at least 30 days and if you like, you can probably get an extension (I did for several months until my boss stepped up).

Removed comment as issue returned

Related

Upgrading Gradle

I am fully aware that there are pages on the Gradle website that say how to upgrade, but only from 4.x and up.
I am trying to follow a tutorial in making a simple 'my first' Minecraft mod. In it, you are told to install forge 1.7.10, which, from what I understand runs on Gradle 2.0.
In order for me to continue with the tutorial, after some digging, it appears that Gradle 2.0 is not compatible with JDK 12.0.2, but I'm not entirely sure how to solve this.
any help is much 'preciated.
extending the answer from Chriki, you can change the gradle version in $projectroot/gradle/wrapper/gradle-wrapper.properties
here you can change the path to point to already downloaded gradle-bin,
something like this (distributionUrl=../../../build/tools/gradle-4.10.3-bin.zip)
or directly to gradle repository
(e.g. distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip)
I’m afraid, you have a chicken and egg problem here: your JDK 12 requires a recent Gradle version (at least 5.4, if I’m not mistaken). At the same time, the forge plugin that is used in your build doesn’t support Gradle 5, yet.
Maybe you can install and use JDK 11 instead? In that case you could work with Gradle 4 with which the forge plugin also seems to work. With my JDK 11 installation I could get the build to work as follows:
sed -i 's/gradle-2.0/gradle-4.10.3/' gradle/wrapper/gradle-wrapper.properties
This changes the Gradle wrapper version to 4.10.3 in gradle/wrapper/gradle-wrapper.properties (can also be done manually with a text editor). When I now run
./gradlew project
the build seems to generally work fine. It only complains: “You must set the Minecraft Version!” That’s a different matter, though.
For anyone here from Google, Minecraft Forge versions below 1.12 DO NOT SUPPORT any java version besides JDK8. You need to install JDK8.
The maximum version you can update your Gradle to is therefore 4.8.1, as any versions above that require JDK9.

Can't run service builder (liferay 6.2)

I'm running Eclipse Neon (tried with Mars too) and Liferay 6.2
I try to run the service builder but:
If I run with java 8 (unsupported, I know), it says it requires a 1.6 compliant JVM. Correct.
If I run with java 7, it says "Unsupported major.minor version 52.0". That's my nightmare.
Yes, I've cleaned everything before. In fact, I created a brand new project, in an Eclipse with only jre7 installed, pointing all to jre7 (compiler, facets...)
Eclipse is running over jre8, but can't run on jre7 because some of the plugins requires jre8. Anyway, some days ago it do worked in this Eclipse, so it's not the problem.
Service Builder might pull code from more than your Eclipse project setup - e.g. from the running Liferay installation that the plugin sdk points to.
I've not heard of a com.aspr.seu package in Liferay - is that your own, or unknown to you as well?
If service builder ran in the past (e.g. with Java 8), it created a yourprojectname-service.jar - that might be one that is pulled into the build process and that you might not have cleaned yet. You definitely have a class that was built with Java 8 on the classpath, you'll just need to find it. It might help to know that servicebuilder is executed through an Ant task outside of Eclipse, thus it might not be enough to search through all of the files that Eclipse has configured on its classpath, but rather on what's configured for the Plugins-SDK

Should I Uninstall Eclipse, or Just Install a New Version on Top?

To preface, I am a student and have limited experience with IDEs. My situation is that I currently have two versions of Eclipse on my machine (OSX El Capitan), one being a C/C++ IDE (Mars) and the other is a Java IDE (Mars.2). I am interested in upgrading to Eclipse Neon for my Java IDE.
Would it be a good idea to uninstall my current Mars.2 version, or just install Neon on top of what I have?
Or, is there a another simple way to upgrade?
If the solution involves uninstalling my Mars.2 version, what files/directories do I need to delete so that my C++ IDE remains functional?
I apologize for the newbie question, but I wanted to get an expert's take that I can bring into my (hopeful) career.
Thanks.
No need to uninstall existed Eclipse since it's allowed to let multi eclipse run on the same machine.
If no big change has been made from original eclipse, I suggest just download a new version eclipse and unzip it to a different folder from existed eclipse folder based on instructions from FAQ How do I upgrade Eclipse IDE?
We strongly recommend against unzipping over your existing Eclipse
version as unexpected side effects may occur, including (but not
limited to): nausea, vomitting, shortness of breath, corrupt
installation.
You can then point the new Eclipse version to your existing workspace(s) and it will load with all your projects and preferences intact.
If your you have added many plugins and preferences to current Eclipse, please follow Easiest way to upgrade eclipse 3.7 to 4.2 (Juno) to migrate the plugins and preferences. Although that's a bit of a dicey process, since many plugins would be incompatible or need to be updated themselves. Better to just install whatever third-party plugins you use into the new Eclipse installation.

How to run old STS 2.8.0 GWT SDK project in new STS 3.7.2?

I unfortunately happened to have to fix an old project written by somebody else long ago. All they left were brief instructions regarding what IDE did they use and what configurations to select to compile.
I have the old STS version they used and the project can be launched in it. The problem is that the IDE is incredibly laggy and erroneous. It randomly crashes on memory exceptions, needs me to clean and rebuild often as it messes up builds, randomly not compiles java classes and so on. I want to try whether they improved at least some of that over the years.
I downloaded the new STS. I backed up my workspace, fortunately, because of course new STS also messes up things as I quickly learned. This is the menu I used to launch the project from old STS:
New STS deleted the items:
The IDE instructions for the project state that the the GWT should added using Window -> Preferences -> Google -> Web Toolkit. You guessed it, it's not there:
How to run GWT project in new STS IDE?
It looks like someone installed the GWT plugin for Eclipse into the old STS installation and you don't have that yet in the new STS installation. I would recommend to take a look at: https://developers.google.com/eclipse/ to get instructions on that extension of Eclipse.
I am sure there is also an item on the STS Dashboard Extension install to easily grab the Google Plugin and install it into your STS version.
Aside of that I would be interested in hearing more details about what exactly the latest STS version is messing up. Please let us know the details behind your projects so that we are able to fix them for the next version. A simple "of course new STS also messes up things as I quickly learned" doesn't help much. Would appreciate more details and reports about that doesn't work as expected.

java.lang.NoClassDefFoundError on mac 10.5

My problem started the other day when I tried to run a jar file that was compiled in java 1.6 from a friend. I then got:
java.lang.NoClassDefFoundError
Since I was only using java 1.5 obviously. So I updated using the system update. This did not help and when I ran:
java -version
in the terminal it still said I had java 1.5. I then saw on the internet that there was an "java SE update 4" on apples download page available. I downloaded and installed this file but it still wouldn't work. I gave up and decided to go back to my programming in eclipse. When I tried to compile and run my application in eclipse I now recieved the same error java.lang.NoClassDefFoundError and it wouldnt let me proceed. I tried right clicking the project and viewing the properties but it wouldnt let me, just gave me another error. I figured I might messed something up when I installed the new java version so I tried reinstalling eclipse but it still gave me the same error. I tried creating a new workspace but that wouldnt help either. I then figured I would try to compile throught the terminal using:
javac main.java
java main
But I still get the same error. I went in under systems settings and diabled "java 1.6" and i tried creating new projects with both javaSE-5 and javaSE-6 but it just wont work. My thoughts now is if it has something to do with eclipse not being able to access the bin & src directories in the project directory but that should work if i reinstalled it? I also saw someone mention setting the classpath in os x but I don't know. I would really need some help solving this issue since a lot of my work rely on eclipse working. I would rather not have to reinstall the whole OS just because of this but if I can't get it to work I guess there is no other alternative.
Best Regards
Jonas Kristensson
"Reinstall the whole OS"? Good lord, no.
Your problems have nothing to do with the version of Java. You don't understand how CLASSPATH works.
The class you were trying to run wasn't on the CLASSPATH. If your friend gave you a JAR, you need to add it to your CLASSPATH and use the fully-resolved class name to run it.
A word of advice for your future mental health: When you have problems, don't assume the worst and jump to extreme measures. Try the simple solutions first.
I tried to run a jar file that was compiled in java 1.6 from a friend. ... Since I was only using java 1.5 obviously
Note that if this was really the case you'd get a java.lang.UnsupportedClassVersionError, since Java 5 can't run classes compiled for Java 6 (it might be able to do so, but the class files say "I'm Java 6+" (class version 50) and thus Java 5 would just refuse to run it (max class version in Java 5 would be 49).
Try to compile with
javac -source 1.5 target 1.5 .....

Categories

Resources