java.util.zip.Deflater and GWT - java

Is java.util.zip.Deflater available in GWT 2.6.0? Do I need to do anything special to be able to use it?
I get this error message currently when trying to compile as part of running Super Dev Mode:
[ERROR] Line 238: No source code is available for type java.util.zip.Deflater; did you forget to inherit a required module?

You can't use java.util.zip.Deflater at client side in GWT application because GWT is unable to compile it into JavaScript.
Read more about GWT library emulation

Related

LibGDX GWT/HTML with Kotlin: "No source code is available for type <XYZ>, did you forget to inherit a required module?"

I generated a simple libGDX project with no dependencies. When I tried to build it as HTML app with Gradle (./gradlew html:dist), I get the following error message:
Tracing compile failure path for type 'xjcl.downgradius.client.HtmlLauncher'
[ERROR] Errors in 'file:/home/jan/Dropbox/py/AndroidStudioProjects/Downgradius_Android/html/src/xjcl/downgradius/client/HtmlLauncher.java'
[ERROR] Line 49: No source code is available for type xjcl.downgradius.DowngradiusGame; did you forget to inherit a required module?
I think the problem is caused by me using Kotlin in this project, and libGDX being intended for Java development. I observed that when I made a new main Game class in Java, that class was found by GWT, but not the Kotlin classes it imports.
I know Kotlin does some re-packaging (for example, if you put funA and funB in file Foo, they will be re-packaged as part of a new FooKt package, I think), but it should be able to find it as
it is declared in the right package (xjcl.downgradius)
it is declared as the only class in its file
I get no IDE warnings about importing it from Java.
I also tried converting Kotlin to Java code but the resulting Java code was full of errors.
Your assumptions are correct. GWT compiler works on Java sources. The error message it gives you is correct: There are no Java source code files to be found, you say it yourself that you used Kotlin.
If you want to use GWT, convert to correct Java source code.

How to include a library in Java which in C++ with having native binding in Java (librets)?

I am stuck at importing a library which is originally written in C++, but has native binding for Java. Here is the library https://github.com/NationalAssociationOfRealtors/libRETS, and I was able to build it through the doc in doc/build, but what after that? I see some makefiles in project/build/ and I want to import this library in Java. Any help will be really appreciated as I cannot find anything in the documentation, all I know is there are some makefiles and the description claims that this library has native bindings for other languages.
Watch the output of ./configure carefully and make sure the build is configured to create the SWIG components (namely, for Java.)
Option summary:
Use ccache .................: no
Use dependency checking ....: no
Use -fPIC...................: yes
Use shared dependencies.....: yes
Compile type................: Normal
Compile examples............: no
Compile SQL compiler........: no
Compile SWIG bindings.......: no <-------- should say yes
With DotNet...............: no
With Java.................: no <--------- me too
With PERL.................: no
With PHP..................: no
With Python 2.............: no
With Python 3.............: no
With Ruby.................: no
With Node.js..............: no
Enable Maintainer Docs......: no
I tried it and a fairly recent version of SWIG was required -- more recent than were in my package manager. Without that, the SWIG bindings don't get built and there's no Java.
However, once you do get that build, it should be a fairly straightforward endeavor of calling into a jar file, as with any other Java project. Who knows, the build might even generate Javadoc for you so you have some idea of what to call.

libGDX GWT compile error that appears to be related to com.badlogic.gdx.utils.AtomicQueue<T>

I have created a little game using libGDX and I try to compile the html project using GWT compile.
The error I'm getting is the following:
No source code is available for type com.badlogic.gdx.utils.AtomicQueue<T>; did you forget to inherit a required module?
Any ideas?
AtomicQueue is not compatible with GWT, you'll have to use another type of queue or not target GWT.

How to override a java library in plugin development environment

I develop an application in a "special" plugin-development environment.
This environment needs to include some java libraries by default so that the created plugin-application can be exported and used successfully.
The problem is now that the plugin-environment comes with an old "javax.mail" library. It is not supported to override this library in the environment.
Of course it is possible to include the newer javax.mail library into my plugin-application but the library is not recognized and the old library is used.
Question:
Is it possible to force a Java Application to use a special included library which is using the same package and class names like a "native" library from a "plugin-environment"?
What I have tried:
I tried to rename the package files within the custom library "javax.mail" to "javax_external.mail" and to use something like this in my application:
javax_external.mail.Session session = javax_external.mail.Session.getDefaultInstance(props);
But I get the error: Type mismatch: cannot convert from javax.mail.Session to javax.mail.Session

GWT - Compilation error: No source code is available for type

I am building GWT application by Maven.
When compiling get the following message:
Validating newly compiled units
At first there is this warning:
[WARNING] Don't declare gwt-dev as a project dependency. This may introduce complex dependency conflicts
Then there is this error:
[ERROR] Line 19: No source code is available for type org.apache.commons.lang.StringUtils did you forget to inherit a required module?
Despite this build does not fall and Dev mode works properly.
How can I get rid of these error messages?
Perhaps a reason is in your module file. You should to identify packages that is to be compiled. This is configured in .gwt.xml module.
<source path="packagename">
And GWT compiler will compile packages gwtxmlmodulepath.packagename.
See more
The error means that some of the client code (to be compiled as javascript) contains a reference to the StringUtils class from Apache Commons. This is not allowed because this library contains code that is not GWT-client compatible.

Categories

Resources