Category Archive For "Java"
Java, Spring Boot, and React Boilerplate Project
I needed a project boilerplate that uses Java, Spring Boot on the back-end, and React on the front-end. Basically a combined Java, Spring Boot, and React Boilerplate Project. I’ll detail the setup in a later post. You can find the code here on GitHub: https://github.com/btaz/jaws.
Get the Current Working Directory in Java
How do you get the current working directory in Java? There are a few different ways of getting the the current working directory. System Property user.dir The System class contains properties that describes the configuration of the current working environment. The property that returns the current working directory is “user.dir”. String userDir = System.getProperty(“user.dir”);System.out.println(“The current …
The Complete Maven pom.xml Structure Documentation
Maven is a tool for building Java applications. It has a pom.xml file that contains all the build instructions as well as a list of project dependencies. The pom.xml file has a bewildering amount of configurable options. The complete Maven pom.xml structure documentation (project descriptor file) is here on the Maven web site. This page …
External File Sort In Java
How do you sort a lot of data in Java? It’s easy to sort small amounts of data in memory. For example if your data is in a List object, then with the help of the Collections class you can easily sort the data. You can provide a custom Comparator to control in what order your data …
DbVisualizer auto commit problem
I had some issues with DbVisualizer and auto commit. I wanted to be able to turn it off from the SQL commander. The official documentation states that you can do this using: The Auto Commit setting is enabled by default and can be adjusted in the Connection Properties. You may also adjust the auto commit …
Java primitive data type sizes for byte, short, int, long, float, double and char
A handy list for Java data types and sizes Integer Data Types Data Type Size Digits Min Max byte 8-bit signed 3 -128 127 short 16-bit signed 5 -32,768 32,767 int 32-bit signed 10 -2,147,483,648 2,147,483,647 long 64-bit signed 19 -9,223,372,036,854,775,808 9,223,372,036,854,775,807 Floating Point Data Types Data Type Size float single-precision 32-bit IEEE 754 floating …
How to find project dependencies in a Maven project
It’s very useful to be able to see what is included in your class path especially when you’re trying to track down a troublesome dependency. Recently I had an issue with a JDOM dependency; however I had not defined a JDOM dependency in my pom.xml file and I couldn’t quite figure out why this dependency …
Want to use Spring 3.0 milestone release from Maven?
I wanted to add the Spring 3.0 M4 milestone early access release to a Maven project to test out some of the new features. However Spring milestone releases are not readily available in the standard public Maven repositories, so what do you do? For the full explanation check out the link to “Spring/Maven Repositories” link …
JUnit 4 error: reference to assertEquals is ambiguous
This is a somewhat confusing compilation failure that sometimes happen when you write unit tests using JUnit 4. This is an example code snippet that produces this error (result.getValue() returns an Integer object): assertEquals(12345, result.getValue()); And when you try to compile your project it produces a compilation error like this: /projects/myapp/src/test/java/org/myapp/MyTest.java:[88,8] reference to assertEquals is …
Spring XML and defining end of line characters in a bean property
If you need to define and end of line character (EOL) like n in your Spring XML files in a bean property you can’t do this <bean id=”some-bean-id” class=”some-class”> <property name=”my-property-name” value=”n”/> </bean> This simply wont work. You’ll end up with a backslash followed by the letter n. What you have to do is to …
Recent Comments