I apologize if this is a duplicate, but I can’t seem to find this answered anywhere. What is the best way to increase the maximum Java heap size when using Apache Karaf? Currently, I modified the following line in the karaf.bat file: set DEFAULT_JAVA_OPTS=-server -Xmx<NewMaxValue>M. I feel like mo…
Tag: java
Correct way to check Java version from BASH script
How can I check whether Java is available (in the PATH or via JAVA_HOME) from a bash script and make sure the version is at least 1.5? Answer Perhaps something like:
Java if statement is skipped
In the following Java code, the if statement conditional does not evaluate to true and its block is skipped. Input has the right value, so why is the System.exit(0) skipped? Answer This is a classic. Don’t use “==” for comparing Strings, use String.equals().
Configuring Gradle project to depend on lwjgl
How do I configure build.gradle to depend on LWJGL? I’m new to Gradle, and how to configure library dependencies is clear as mud to me. It’s my understanding is that one can specify library dependencies for Gradle to download rather than checking them in to source control, but any sort of help wit…
Attributes / member variables in interfaces?
I wish to know is there any way in which I can make it compulsory for the implementer class to declare the objects handles/primitives as they do with methods. for e.g.: In the above method how can we compel Tile class to declare height and width attributes using the interface? For some reason I wish to do it …
The builder pattern and a large number of mandatory parameters
To date I use the following implementation of the builder pattern (as opposed to the implementation described here): This works well for most situations I’ve encountered where I need to build up a complex object with a variety of required/mandatory and optional parameters. However, I’ve been strug…
Where does this grid variable come from?
I am looking at the ColumnGridReport example for DynamicReports. I would like to use the classic code syntax instead of the DSL used in the example, meaning creating JasperReportBuilder report = …
Best way to consume RPC/encoded webservice?
I need to consume old-school RPC/encoded WSDL webservice for my backend. At first I tried to use Apache CXF and JAX-WS for that, but JAX-WS wsimport tool doesn’t eat rpc/enoded WSDL. [ERROR] rpc/encoded wsdls are not supported in JAXWS 2.0. I’m also in doubt about using JAX-RPC for this job, becau…
What is the use of a private static variable in Java?
If a variable is declared as public static varName;, then I can access it from anywhere as ClassName.varName. I am also aware that static members are shared by all instances of a class and are not reallocated in each instance. Is declaring a variable as private static varName; any different from declaring a v…
How to convert HSSFWorkbook to XSSFWorkbook using Apache POI?
How to convert to in Apache POI? Environment : JSE1.6 JBossAS 4.3.2 POI 3.7 Answer this code has been adapted from what I found here on coderanch forum