change java version to build play app with activator - typesafe-activator

Is it possible to set java version for the play app build with activator
I have java 8 on my sytem and server is with java 6. I want to create build with java 6 from activator.
I tried to set JAVA_VERSION 1.6 in activator file but when its deployed on the server it gave class version error.

If you set the JAVA_HOME environment variable to the location of the desired JDK before launching activator, that Java should be used.

Related

GWT hello world app does not compile and asks for 'com.google.gwt.core.Core'

I haven't done GWT development for a while and wanted to try again. In my Windows 10, I installed JDK 12 and Eclipse 2019-03. I installed GWT Eclipse Plugin (GWT 2.8.1).
From Eclipse, I created a hello world project this way:
Click on 'New GWT Application Project'
Project name: Gwt5, Package: com.foo, Use default SDK (GWT 2.8.1)
Click on 'GWT Compile Project'
I see this error:
Compiling module com.foo.Gwt5
[ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
I didn't change my gwt.xml. I checked and "com.google.gwt.user.User" is there.
Any suggestion?
When language compliance level or JRE is set to higher than what GWT supports, this error occurs (The error message is not very helpful though).
As of May 2019, GWT supports only up to Java 8, and that is provided by JDK 1.8. For example, to make GWT work with Oracle's JDK, you need to download an older version of JDK (Java SE), than set both the Compiler compliance level and Installed JRE to:
Compiler compliance level: 1.8
JRE Home: C:\Program Files\Java\jdk1.8.0_202\

Error running simple program in NetBeans 9.0

I'm trying to use NetBeans for a JDBC project. However, I'm getting runtime errors when I try to compile. I decided to try a "hello world" project and I couldn't get that to run also. I'm in NetBeans 9.0 with Java JDK 10.0.2.
Error Message:
Exception in thread "main" java.lang.RuntimeException:
at javaapplication2.JavaApplication2.main(JavaApplication2.java:1)
C:\Users\James\AppData\Local\NetBeans\Cache\dev\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\James\AppData\Local\NetBeans\Cache\dev\executor-snippets\run.xml:68: Java returned: 1
BUILD FAILED (total time: 1 second)
xml debug:<call-java classname="#{classname}" classpath="#{classpath}" modulename="#{modulename}" modulepath="#{modulepath}">
package javaapplication2;
public class JavaApplication2 {
public static void main(String[] args) {
System.out.println("Hello");
}
}
It is very easy, your JDK version is not 100 % compatible; use version 8.2, which is the most stable for Arduino and others.
To change platforms without deleting the existing one, simply go to Tools / Java Platforms / click on the button add Platforms.
Download/install JDK major version number the same as NetBeans.
i.e. If You have NetBeans 9 version, but your JDK is version 10,So try use NetBeans 10 version... or download/install JDK 9 (the same as NetBeans).
Create new java platform for new jdk installation.
Open netbeans menubar->tools->Java Platforms->Add Platform Specify the folder that contains the Java platform as well as the sources and Javadoc needed for debugging.
Set new java platform to your project
Right click on project ->properties->Libraries->Java Platform->select the jdk version that same as NetBeans.
Select source format of your project
Right click on project ->properties->Sources->Sources/binary format->select the jdk version that same as NetBeans.
If it still give same error,Open the project properties, select the Build-Compiling, uncheck "Compile on save" and rerun the application. This will make sure all your source code becomes recompiled before running it.

Changes to kotlin class not recognized by Spring Boot?

Changes are not reflected in the service response from http://localhost:8080/hi after:
Modifying the response string of SomeController in the code below
Spring Tool Suite automatically compiles the changes
Spring Boot DevTools automatically restarts the server
Request to http://localhost:8080/hi still gives the old response
Somehow they're getting cached, even after running ./gradlew build manually.
Totally different issues: I have Java 1.8 JRE and JDK installed into two directories under Program Files\Java. The project shows the JRE dependency and running build from STS Gradle Tasks window yields the JRE instead of the JDK, even though JAVA_HOME is properly set to the JDK, STS is configured to use the JDK by default (JRE unchecked), and the Spring Boot Project is configured to use the workspace settings (JDK). It seems to be picking up the JRE from the IDE runtime itself, instead of from the settings? I found a work-around by right-clicking the build task and selecting build -> Open Gradle Run Configuration -> Java Home and manually setting this to the same directory as the JDK. I also found a workaround for the project with right-click on project Properties -> Java Build Path -> Libraries, removing JRE System Library and adding the JDK (Add Library... -> JRE System Library -> Workspace default JRE (jdk1.8.0_144)). But, sometimes the project resets itself to the JRE somehow.
Gradle Distribution: Gradle wrapper from target build
Gradle Version: 4.5.1
Java Home: C:\Program Files\Java\jre1.8.0_171
Code
package com.example.demo
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
#RestController
class SomeController {
#GetMapping("/hi")
fun hi(): String {
return "hey"
}
}
#SpringBootApplication
open class DemoApplication
fun main(args: Array<String>) {
runApplication<DemoApplication>(*args)
}
Configuration
Windows 10 Pro
Spring Tool Suite 3.9.4.RELEASE
JDK 1.8
Kotlin 1.2.41
Gradle Wrapper 4.5.1
Spring Boot + DevTools 2.0.3.RELEASE
Setup Steps
New workspace in STS with Gradle Buildship and Kotlin extensions
Add JDK 1.8 as default
Create project File -> New -> Spring Starter Project
Gradle (Buildship 2.x)
Java 8
Kotlin
Reactive Web
DevTools
Actuator
Right-click project Configure Kotlin -> Add Kotlin Nature
Start service Boot Dashboard -> local -> demo [devtools] [:8080]

NoSuchMethodError: org.eclipse.jetty.util.MultiMap.add

I loaded my Spring/Maven project in Eclipse (Spring Tools Suite variant), installed Run Jetty Run, and clicked Run Jetty.
PROBLEM: Jetty does not start correctly:
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Running Jetty 9.0.0.M3
ParentLoaderPriority enabled
Enable config class:runjettyrun.webapp.RJRWebInfConfiguration
Enable config class:org.eclipse.jetty.webapp.WebXmlConfiguration
Enable config class:runjettyrun.webapp.RJRMetaInfoConfiguration
Enable config class:org.eclipse.jetty.webapp.FragmentConfiguration
Enable config class:runjettyrun.annotation.RJRAnnotationConfiguration
Enable config class:org.eclipse.jetty.webapp.JettyWebXmlConfiguration
Enable config class:org.eclipse.jetty.webapp.TagLibConfiguration
ProjectClassLoader: entry=/home/nico/src/nemaki/core/target/classes
ProjectClassLoader: entry=/home/nico/.m2/repository/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1.jar
[... many other JAR libraries, none being Jetty ...]
ProjectClassLoader: entry=/home/nico/.m2/repository/jp/aegif/nemakiware/nemakiware-common/2.3.10/nemakiware-common-2.3.10.jar
Excluded entry=/home/nico/src/nemaki/core/target/test-classes
2016-09-30 17:17:09.780:INFO:oejs.Server:main: jetty-9.0.0.M3
2016-09-30 17:17:12.121:WARN:oejuc.AbstractLifeCycle:main: FAILED o.e.j.w.WebAppContext#694e1548{/core,[file:/home/nico/src/nemaki/core/WebContent/],STARTING}: java.lang.NoSuchMethodError: org.eclipse.jetty.util.MultiMap.add(Ljava/lang/Object;Ljava/lang/Object;)V
java.lang.NoSuchMethodError: org.eclipse.jetty.util.MultiMap.add(Ljava/lang/Object;Ljava/lang/Object;)V
at org.eclipse.jetty.annotations.ClassInheritanceHandler.handle(ClassInheritanceHandler.java:56)
at org.eclipse.jetty.annotations.AnnotationParser$MyClassVisitor.visit(AnnotationParser.java:398)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
QUESTION: How can I fix it?
You are running an unstable version of Jetty.
Version 9.0.0.M3 is not a stable release (that's an experimental milestone release, a candidate for release, something to help integrators start to evolve their code for the eventual release).
Use a stable release, such as 9.3.12.v20160915 and you'll have a much better experience.
In 9.3.12.v20160915 the MultiMap class can be found in jetty-util-9.3.12.v20160915.jar
Also note, Jetty 9 is servlet 3.1, not 3.0.1 (seen in your output)
As explained by Joakim, 9.0.0.M3 is an old version of Jetty.
Fortunately, Run Jetty Run has been updated a few weeks ago.
Here is how to use the latest Run Jetty Run:
Uninstall from Eclipse any existing version of Run Jetty Run
Add this update site: http://xzer.github.io/run-jetty-run-updatesite/nightly/
Install from it the required component and the optional component 9.3.6
You now have Run Jetty Run using Jetty 9.3.6, which is a year old already but does not trigger the error above. Be sure to select it in Run configurations.

UnsupportedClassVersionError deploying EJB "HelloWord" in Glasshfish 3

I try to deploy a simple "Hello Word" in my local server GlasshFish 3, but at the deploy the console print this message
[#|2013-01-15T15:00:02.458+0100|SEVERE|glassfish3.1.2|
javax.enterprise.system.tools.admin.org.Exception while deploying the app
[HelloWorldEJB] :UnsupportedClassVersionError: Class ejb_other.PlaceAuctionItemBean
as unsupported major or minor version numbers, which are greater than those found
in the Java Runtime Environment version 1.6.0_27|#]
My JAVA_HOME has java version 1.6.0_27 (it refers to _C:\Program Files\Java\jdk1.6.0_27_), my Eclipse (indigo) project refers to java 1.6.0_27.
I think (i don't know how to verify) that GlasshFish refers to JAVA_HOME.
In my PC (Windows 7) I found 2 directory having java.exe:
C:\Windows\SysWOW64>java -version -->>java version "1.6.0_29"
C:\Windows\System32>java -version -->>java version "1.6.0_27"
I found more discussions about this exception (f.e. this or this ), but I need of something more specific for Eclipse/Glasshfish, because I can't to solve. I see that the JVM is the same for compilation and execution.
Post Scriptim
I add the screenshot about the places where I declare JVM: it's always 1.6.
one:
two:
three:
Where can I see that I compile with java 7 or it runs with another JVM?
ejb_other.PlaceAuctionItemBean was obviously compiled for Java 7 which won't work if you run it in a Java 6 JVM.
Found solution
There's another place where setting the compiler's options:
how do I get eclipse to use a different compiler version for Java?