Seeing no solution, I removed all JREs and JDKs from my computer (both 8 and 9), and re-installed only JRE 8.
In the console, java -version shows 1.8.0_152.
The first time I launched CUBA Studio, the above error did not occur. However when trying to launch the application server, I got:
The 2nd time I launched CUBA Studio, I again see the initial error with Java Home.
Apologies, I mentioned JRE in the previous post, I meant JDK. This is what I have done. Installed only JDK 8, and JAVA_HOME is pointing to it (see screenshot in 2nd post).
I had restarted several times, I tried once more, but still, the problem remains.
I HAVE seen CUBA Studio working a few days before on my laptop (with Tomcat launching, accessing sample projects etc.). But something occurred, and now it doesn’t work. I tried uninstalling and re-installing CUBA Studio, but still, no solution.
The message “The supplied Java Home seems to be invalid…” is shown when Studio simply cannot find java.exe in the bin subdirectory of the supplied Java home path. Could you check it? Maybe there are some problems with user permissions or with the file system?
Your hint about the java.exe file led me to discover a very peculiar issue.
I checked the c:\Program Files\Java\jdk1.8.0_152\bin\ directory, and the java.exe file was MISSING !
So here is what I did:
I re-installed JAVA SDK 8.
I confirmed that the java.exe file exists inside the c:\Program Files\Java\jdk1.8.0_152\bin\ folder.
I ran CUBA Studio and launched the browser session.
At this point, the application preferences window with the Java paths works fine, I do not see the Java Home error.
From the browser, I try to start the Application Server.
I get the “Task deploy, start failed” Gradle daemon error shown above (4th post).
And the strange part is: checking now in the c:\Program Files\Java\jdk1.8.0_152\bin\ folder, the java.exe file HAS BEEN DELETED !
So that’s why on a second running, I get the Java Home error.
But why would it fail, and even so, why would it delete the java.exe file ?
Do you have an antivirus?
Is it only java.exe missing or the set of files in the bin folder is completely replaced?
When Studio starts the app server, it actually runs Gradle with setupTomcat deploy start tasks. You can do it manually and separately, watching results. Open terminal in the project folder and run:
gradlew setupTomcat
gradlew deploy
Also, --info or --debug switches will output more information to the console.
Only the java.exe file is removed, the other files in the JDK /bin folder remain.
I have Kaspersky Endpoint Security 10 installed.
I tried to disable Kaspersky, and ran the process again. Now, on launching the server, I see a message related to ‘call_and_exit.bat’:
In this case, with Kaspersky disabled, the java.exe file was NOT deleted.
I tried to run gradlew manually.
‘gradlew setupTomcat’ worked fine.
‘gradlew deploy’ produced a long output, the suspicious lines were:
:app-core:compileJava NO-SOURCE
:app-gui:compileJava NO-SOURCE
The message received from the daemon indicates that the daemon has disappeared.
FAILURE: Build failed with an exception.
* What went wrong:
Could not dispatch a message to the daemon.
I then ran it with --info, this produced a very long listing, the suspicious lines were:
file or directory 'D:\Development\Cuba.Platform\Projects\sample-sales\modules\core\src\main\java', not found
Skipping task ':app-core:compileJava' as it has no source files and no previous output files.
file or directory 'D:\Development\Cuba.Platform\Projects\sample-sales\modules\core\src\main\resources', not found
And these folders actually do not exist.
Thinking something might have gone wrong in the initial setup of the ‘sample-sales’ app, I deleted it, and re-installed it (with Kaspersky disabled).
And now it seems to run OK, even after multiple stops and restarts of the server (always with Kaspersky disabled).
So everything points to Kaspersky detecting, blocking and deleting java.exe.
This is an up to date Kaspersky install, using latest virus definitions. I cannot imagine why something as generic as Java is being detected wrongly ?
Sorry for butting into your conversation, but I just want to thank @Nikos_K! Some time ago I had a problem with one PC, which was 100% similar with what is explained here. I gave up that time and just changed the desktop :). But you have discovered the reason why that issue happened! I disabled Kaspersky and reinstalled everything on that PC and it works fine now!
P.S. This seems to be a common problem for Kaspersky, see this thread for example.
Thank you also Konstantin for providing the tip to check the antivirus software.
This is a strange issue because the Kaspersky AV software does not consider the java.exe file itself as suspect. Doing a normal AV scan in the Java folder does not delete anything, and submitting the java.exe file to:
shows a safe file.
So the false detection must be being triggered by the launching of java.exe from ANOTHER process (most likely something CUBA.Platform related).
I feel you should submit this as a case to Kaspersky for resolution. There must be a large number of people who tried to use the CUBA.Platform and gave up because of it.
Thanks,
Nikos
albudarov
(Alexander Budarov)
Split this topic
#15