Gluon Desktop - Runnable jar - gluon

I am using the 'gradle distZip' command to build my desktop project, but when running the generated script I am having a security error, so Settings and other functions are not working, but it works when using 'gradle run'
`java.io.IOException: Private storage file not available
at com.gluonhq.impl.charm.a.c.a.c(SourceFile:37)
at java.util.Optional.orElseThrow(Optional.java:290)
at com.gluonhq.impl.charm.a.c.a.<clinit>(SourceFile:37)
at com.gluonhq.charm.glisten.application.MobileApplication.a(SourceFile:262)
at com.gluonhq.charm.glisten.application.MobileApplication.start(SourceFile:232)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)`
How to solve this?
Thanks!

Related

Gradle build failing after update

Getting exception while gradle/gradlew build. Build without test cases is successful. This happening when I updated the gradle to 6.0.1
Works fine for gradle 5.6/6.2 version.
Could not write standard input to Gradle Test Executor 2.
java.io.IOException: The pipe is being closed
at java.base/java.io.FileOutputStream.writeBytes(Native Method)
at java.base/java.io.FileOutputStream.write(FileOutputStream.java:348)
at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:835)
Error: Could not find or load main class worker.org.gradle.process.internal.worker.GradleWorkerMain
Caused by: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain
FAILURE: Build failed with an exception.
I just had this happen, and found that stopping the gradle daemon resolved it for me:
gradle --stop
or
./gradlew --stop
depending on your setup (the daemon is relaunched when you attempt to build again).
I encountered this error and the one method I found was dump the whole $HOME/.gradle cache and then rebuild the project.
Starting/Stopping IntellijIDEA and/or rebuilding did not help.
You know you have jumped the complexity shark somewhere when running lowly test cases starts to fail for obscure reasons.
Granted, this happened after a machine crash. But still..
If its a windows system, then try deleting the .gradle folder from the user directory and try to build the gradle. This should solve the issue

MissingResourceException: Can't find bundle base name

When running a jar file that i created from a maven project as such:
java -jar basictool.jar
I get this error exception:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.util.MissingResourceException: Can't find bundle for base name com/kit/version, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(UnknownSource)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at com.factories.FactoryImpl.<init>(FactoryImpl.java:80)
at com.parsers.BasicParser.<init>(BasicParser.java:32)
at com.parsers.FileParser.<init>(FileParser.java:76)
at com.tools.BasicTool.main(BasicTool.java:75)
... 5 more
I created the jar file by using the maven jar creation wizard:
Right-click on project, select Export > Java > Runnable JAR file with options
Launch configuration: BasicTool - work
Export destination: C:\Users\Victor\Documents\basictool.jar
Library handling: Package required libraries into generated JAR
The version.properties file is kept inside of the src/main/resources, as com/kit/version.properties.
I have checked that the version.properties file is found inside of the jar file by running:
jar tf basictool.jar > output.txt
where i find the version.properties file as such:
resources/com/kit/version.properties
I attempt to load the resource like this:
ResourceBundle.getBundle("com/kit/version");
My machine and environment specifications are as followed:
Windows 7, Spring version: 3.7.2.
Note:
I found many questions similar to the one i have, but the answers i have found point to the properties file being properly named or placed in the correct location. From those answers i learned that version.properties is fine, since ResourceBundle.getBundle("com/kit/version") will first look for version.class then version.properties by default. It will also look for version_en_US.properties before ultimately looking for the base name version.properties.
I seem to be in line with the above, since the file version.properties is in the correct location and named correctly. I also seem to be in line with what other answers have offered :(
I would also like to point out that it finds the resource just fine when i run the program from spring, which brings me to suspect that something about the jar's creation process is the cause of the problem.
And it is also important to note that the properties file is in another maven project.
I hope i offered enough/clear details. Any help would be appreciated, thank you in advance!
If your application calls ResourceBundle.getBundle("com/kit/version"); from with in Eclipse everything works fine.
But when you create a jar file in the way you described (export -> java -> runnable jar), the version.properties is placed within the jar file at resources/com/kit/version.properties. Mind the "resources" in front of the path.
If you call this jar with java -jar basictool.jar outside Eclipse the version.properties cannot be found and java.util.MissingResourceExceptionis thrown.
If you change the path and call ResourceBundle.getBundle("resources/com/kit/version"); it won't work within Eclipse but java -jar basictool.jar will do.
It seems exporting the project from Eclipse causes the problem.
I would suggest to create the jar file to use without Eclipse with the maven-assembly-plugin.
An example can be found here.
This plugin creates a jar file without the resources directory and so the call of ResourceBundle.getBundle("com/kit/version"); works within and outside of Eclipse.

Gradle wrapper NoClassDefFoundError

When I run ./gradlew I get
Exception in thread "main" java.lang.NoClassDefFoundError:
org/gradle/wrapper/GradleWrapperMain Caused by:
java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:190) at
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
java.lang.ClassLoader.loadClass(ClassLoader.java:247)
My project compiles using the Android Studio but stopped compiling from command line
Probably something went bad. The solution:
Install gradle: brew install gradle
Regenerate wrapper: gradle wrapper
See https://github.com/drone/drone/issues/256
My .gitignore had *.jar in it, so I wasn't getting all the jars I needed in my repository.
I had the same, or similar, problem when trying to build my app from command line, but with an exception thrown for 'java.lang.ClassNotFoundException: com.sun.tools.javac.util.Context' which did not happen when building within Android Studio. I found out that AS brings along it's own JRE and I resolved the issue by setting 'JAVA_HOME' to the AS JRE path. In my case it turned into:
$ JAVA_HOME=/opt/android-studio/jre ./gradlew build
You can find this path under 'File' -> 'Project Structure' -> 'SDK Location', see screenshot.
I hit this issue when I have a directory with a ":" (no quotes, just a colon) in it.
This was on a linux machine.
Before:
"my:directory"
as in
/Users/me/projects/project1/my:directory/
then i renamed it to
/Users/me/projects/project1/my_directory/
and the error went away.

Trouble installing Kyoto Tycoon - Java. Maven failing

I've downloaded Kyoto Tycoon via:
hxxps://bitbucket.org/EP/kyototycoon-java
When running mvn install I get plenty of warnings telling me it couldn't find several files:
http://pastebin.com/znpJ3d5n
When I first started running the install I was getting a lot of failures and no errors. After blindly going around and trying to install things separately, the output now looks like this. I have no experience with Maven so editing the pom.xml file is out of the question. I've tried using the ignore tests and compiling, and I get few jar files. This allows me to compile "Example.java" using:
javac -cp .:target/kyototycoon-0.2-SNAPSHOT.jar Example.java
I then try to run the code using:
java -cp .:target/kyototycoon-0.2-SNAPSHOT.jar Example
but I get an runtime error:
Exception in thread "main" java.lang.NoClassDefFoundError: Exception in thread "main" java.lang.NoClassDefFoundError: com/twitter/finagle/Codec
at kyototycoon.SimpleKyotoTycoonClient.<init>(SimpleKyotoTycoonClient.java:16)
at Example.main(Example.java:11)
Caused by: java.lang.ClassNotFoundException: com.twitter.finagle.Codec
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 2 more
I'm assuming this all comes back the the maven install failing, but I'm not sure how to fix it.
Any direction is appreciated. There doesn't seem to be a large support group for Kyoto.
For anyone experiencing this same issue, I found that JAR files I needed were being created. They were being stored in ~/.m2/repository/kyototycoon/kytotycoon/. I created a disgusting looking classpath that included all of these JAR files and this allowed me to compile AND run the Example.java file.
If "editing the pom file is out of the question" I'd strongly recommend steering clear of Maven.
In any case, you can install local jars to your repository if the artifact isn't available from any repository.

Play! framework [1.2.4] with Drools on Heroku

I've tried to make simple web app integrated with Drools rule engine and deployed it on heroku. In controller action I'm executing method which imports and parses DRL file, and returns result. I've noticed weird behaviour. When I start app by command play run Drools don't want to work (I get some rule import errors and parse knowledge exception), but when I launch my app through Eclipse everything is working.
I've checked what exactly is executed through these different ways:
Eclipse executes: http://pastebin.com/RK7mnQ81
play run executes: http://pastebin.com/UH1rD7pb
I've tried to run play run with extra Java arguments existing in Eclipse execution, but I haven't found working combination.
Any ideas what arguments add to command play run to find working solution?
Thanks in advance for any help.
Stacktrace:
java.lang.IllegalArgumentException:
at drools.RuleEngine.readKnowledgeBase(RuleEngine.java:66)
at drools.RuleEngine.run(RuleEngine.java:28)
at controllers.Application.index(Application.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:546)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:500)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:476)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:471)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:159)
at play.server.PlayHandler$NettyInvocation.execute(PlayHandler.java:220)
at play.Invoker$Invocation.run(Invoker.java:265)
at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:200)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
Ok, I found a solution for me here: https://stackoverflow.com/a/7083303/894060
I've packed Drools-related classes and rule file in one jar file and I put that jar in one directory included in classpath -- it solved the problem.
I have no idea how to make a workaround/hack to get it worked.
I did the following to resolve the problem.I have added the following line to the file play\framework\pym\play\application.py in the method def getClasspath(self):
classpath.append(os.path.normpath(os.path.join(os.path.join(self.path, 'tmp'),'classes')))
The above just adds the classes which are their in the play tmp > classes directory to the classpath.
Everything works fine.
But i really didn't understand how play is able to resolve these references where as Drools is failing to do so.

Resources