Does Java 1.8.0_31 has the javafx.scene.control.Alert class how can I import it to my project - javafx-2

I'm trying to import Alert class but doesnt work. Does Java 1.8.0_31 has the javafx.scene.control.Alert class can I import it to my project

Java 1.80_31 doesn't have Alert. If you go through the JavaDoc of Alert and scroll down, at the end of class description you will find the since tag which says JavaFX 8u40. As JavaFX follows the update version of Java, it means it is available since Java 1.8.0_40.
You need to use Java version greater than or equal to Java 8 update 40 to use Alert in your project.

Related

Xzing barcode : I'm getting type mismatch error in fragment using androidx.fragment.app.Fragment

I'm using Android studio 4.0, coding in Kotlin and I'm still really new at Android development.I need to integrate the Xzing barcode libray. I've copied some code from the tutorial at [https://tutorialwing.com/implement-android-qr-code-scanner-using-zxing-library-in-kotlin/][1]. The tutorial uses the following import statement:
import android.app.Fragment
I've modified a fragment that was generated with the Navigation Drawer Activity template. It uses the androidx fragment import statment:
import androidx.fragment.app.Fragment
The errors it occurs on the following line with the "this" reference:
qrScanIntegrator = IntentIntegrator.forFragment(this)
The error is:
Type mismatch: Required Fragment! found HomeFragment
Changing my import to the older version to the older version is not recommended and if I do I get a lot of other errors.
What can I do to get zxing to work with the androidx fragment?
Thanks
The ZXing library is no longer maintained, and that particular class (IntentIntegrator) only supports android.app.Fragment which is the deprecated Android framework version of the AndroidX Fragment class.
You have a few possible options here:
Fork the ZXing library, and change the android.app.Fragment import to use the androidx.fragment.app.Fragment version instead.
Delegate the IntentIntegrator calls to your Activity instead, and have the results forwarded to your Fragment.
Simply duplicate the Intent initialization code from IntentIntegrator to a helper class of your own. The IntentIntegrator methods are just convenience methods to build an Intent and call startActivityForResult(). You'll still be able to use the IntentIntegrator.parseActivityResult method to interpret the result that comes back.
I would recommend going with option #3.
As a longer term alternative, you may also want to consider looking into Firebase ML Kit since ZXing is no longer maintained.

java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller

I am trying to generate Excel using Xssf API because its memory footprint is small.
It is working fine in my local machine which is having jdk1.7.
But when I try to run it on UNIX where java version is 1.6.0_75 it gives me the following error.
java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller
I have following jars in my classpath
poi-3.11-20141221.jar
poi-excelant-3.11-20141221.jar
poi-ooxml-3.11-20141221.jar
poi-ooxml-schemas-3.11-20141221.jar
xmlbeans-2.6.0.jar
xercesImpl.jar
I have verified that poi-3.11-20141221.jar has the ZipPackagePropertiesMarshaller class.
Seems that some jar is missing.
Am I missing something?
I have found a solution to my own problem.
I replaced poi-3.11-20141221.jar with poi-ooxml-3.9.jar. That worked.
Java version 1.6.0_75 does not exists, I suppose you make a typo. The last update of Java 6 is the update 45 (6u45).
The class ZipPackagePropertiesMarshaller is loaded at run-time for sure. The exception NoClassDefFoundError occurs during the initialization phase; if the exception had been ClassNotFoundException, it would have been different...
The class ZipPackagePropertiesMarshaller is unaltered between the versions 3.11 and 3.9, but the class PackagePropertiesMarshaller extended by ZipPackagePropertiesMarshaller is changed: the main change regards the use of StAX in the newer version.
The distribution of StAX coming with Java 6, but the version of Java 6 update 18 (http://www.oracle.com/technetwork/java/javase/6u18-142093.html) introduces the StAX 1.2 API version.
Consider to use Java 6u18 or newer. This should solve your problem.
In the official FAQ there are some indications about a similar problem: https://poi.apache.org/faq.html#faq-N1017E.
Moreover, the workaround you found is not the best one, see the last FAQ of POI.

How can i specify attribute of my own ViewGroup(Layout) in an axml file?

I'm trying to adapt Ravi Tamada's blog entry to Mono for Android.
But at the 6. step i stopped. How can i specify
<!-- Your package folder -->
<com.androidhive.dashboard.DashboardLayout ...
attribute, at fragment_layout.xml file?
I try to give a package name specified at Xamarin solution or specify my VS2010 namespace at java form (MySolution.MyProject.MyFolder.DashboardLayout -> mysolution.myproject.myfolder.DashboardLayout) but result is same error:
Design mode gives following: "the layout could not be loaded: com.android.layoutlib.bridge.mockview cannot be cast to android.view.viewgroup"
The question is, how can i use my DashboardLayout.cs (ViewGroup) class as attribute like Ravi Tamada's java example. (6. step)
Thaanks.
Unfortunately, this is a bug in Mono for Android/the Designer and is already filed on Bugzilla here: https://bugzilla.xamarin.com/show_bug.cgi?id=7680
Hopefully this will be fixed soon, you can CC yourself on the bug so you can updates when anything changes.

how to add sound effects to a Groovy / SwingBuilder application?

I've created a desktop application using Groovy and SwingBuilder.
I would like to add sound effects to my app.
How can I do that ?
Thank you...
There is nothing specific in groovy that you could use to add sound effect. Instead just use the existing Java libraries like this:
import sun.audio.*;
import java.io.*;
AudioStream as = new AudioStream(new FileInputStream(Filename));
AudioPlayer.player.start(as);
Encapsulate this code in a separate class and call it from your groovy application.

cannot import groovyx.net.ws.WSClient from either groovysh or groovyConsole

hi i tried import groovyx.net.ws.WSClient from both groovysh or groovyConsole, adn netbeans ...
it just says "cannot resolve class groovyx.net.ws.WSClient"
any body gives me an hint?
thanks!
The Groovy WSClient is not part of the core groovy distribution. It is actually a separate standalone library. You need to download it separately and put it on your classpath or use the Grab annotation to download it at runtime.
Example:
#Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.1')
import groovyx.net.ws.WSClient
Note that this was done with Groovy 1.7.2. Previous to 1.7 #Grab was not available on imports. If you are using an older version, put the #Grab on a method.

Resources