background preloader


Facebook Twitter


Morphic. Squeak. Scratch. JNLP Support in the Next Generation Java™ Plug-In Technology (introduced in Java SE 6 update 10) Table of Contents Introduction The next-generation Java Plug-In technology (hereafter the "Java Plug-In") provides support for launching applets directly from JNLP files. Previously, only Java Web Start utilized JNLP files, for the purpose of launching Java applications. Now Java applets can be described using the same meta-descriptor. This new functionality offers many benefits: Access to JNLP extensions in applets. This document highlights the slight semantic differences when using JNLP to describe Java applets in the browser, and provides examples of simple and advanced applet deployment via JNLP.

Usage To launch an applet from a JNLP file, use the jnlp_href parameter in the <applet> tag: my_applet.jnlp <? Developers who have used Java Web Start will already be familiar with the JNLP file format. Semantics The <applet> tag and the JNLP file have overlapping mechanisms for specifying certain parameters.

Codebase Handling Specification JNLP files reference other JNLP files in a tree structure. Java ClassLoader – Part 2 – Write your own ClassLoader | analyzejava. This is the second part of series of articles about Java’s ClassLoader. We will show here how you can write your own simple ClassLoader and “replace” the default system ClassLoader with your version. We have to extend the java.lang.ClassLoader class and implement some of its crucial methods, like loadClass(String name). This method is run every time somebody requests a class inside the code, and receives as a parameter the full name of the class to load.

In our implementation we will print out this name, so to know when our method was called, and then load the class with our class loader if the class is in “javablogging” package. If the class is not in “javablogging”, we will use the super.loadClass() method, which will pass the request to the parent class loader. For a bunch of classes from the “javablogging” package (we will see one of them in a minute) we will load them ourselves from the .class files instead of passing a request for them to the parent class loader. Like this:


RebelLabs All Reports Page - Free Technical Content for Geeks. Java - How to get the path of a running JAR file? Birt. Java8. Swing. JavaFX8. JDBC. JDBC. Why is Java I/O Slow? - Red-Green-Code. You can read a lot on Quora about the best language to use for competitive programming. Here are some of the points covered by those questions: C and C++ execute quickly, and their macro support can reduce the amount of code that you end up typing in your solution.A language like Java can be useful for problems with some specific requirements (such as integers that don’t fit in 64 bits, or calendar problems).The main contributor to execution speed is the algorithm that you use, not the language that you choose to implement it.

But the language can provide a performance edge at the margins.Choice of language is less important for more recent contests, since problem setters have made an effort to level the playing field (e.g., by testing Java solutions to ensure that the time limit is sufficient). One thing about the uHunt problems that I’m working through is that they draw from a database of contest problems going back to the 1990s. Output Tests System.out.println BufferedWriter Input Tests. From Runtime.exec() to ProcessBuilder - Java Tips. This Tech Tip reprinted with permission by Before JDK 5.0, the only way to fork off a process and execute it local to the user runtime was to use the exec() method of the java.lang.Runtime class. JDK 5.0 adds a new way of executing a command in a separate process, through a class called ProcessBuilder.

You can find ProcessBuilder in the java.lang package (like Runtime and Process). This tip discusses and compares both approaches. If you're familiar with the Runtime class, you know that it also allows you to discover memory usage and add a shutdown hook. Before you call the exec() method, you specify the command and its arguments, environment variable settings, and working directory. Here's an example, DoRuntime, that shows how to execute a command with the original Runtime class.

If you run DoRuntime in Solaris like this: You get output that looks something like this (which depends on the contents of the directory): to: So what's wrong with this approach?


Spreadsheets. Asprise Java OCR SDK - royalty-free API library with source code examples converting images to word or searchable PDF by extracting text. Asprise OCR for Java Installation¶ There are two options: add Asprise OCR as a maven/gradle dependency or manually download the SDK from Option 1: Add Asprise OCR as a Maven/Gradle Dependency¶ If you are using maven for your build, simply add the following dependency to your pom.xml (under element: /project/dependencies): Asprise OCR as a maven dependency¶ <dependency><groupId>com.asprise.ocr</groupId><artifactId>java-ocr-api</artifactId><version>[15,)</version></dependency> For gradle users, you need to add the following line to your build.gradle (under dependencies): Asprise OCR as a groovy dependency¶ compile group: 'com.asprise.ocr', name: 'java-ocr-api', version: '[15,)' For Scala SBT: Asprise OCR as a Scala SBT dependency¶ libraryDependencies += "com.asprise.ocr" % "java-ocr-api" % "[15,)" After adding Asprise OCR as an dependency, you can then launch and play with the demo program: Later sections will introduce how to invoke the OCR API without the UI. |--- javadoc [Java docs]

Codecity for Eclipse Visualises Source Code Metrics. During EclipseCon, Marcel Bruch released an alpha version of Codecity for Eclipse, which calculates source code metrics and presents them in a city block layout. After installing from the marketplace or the update site, a new option 'Show in → Codecity' will be enabled on project resources or source folder.

After calculating a set of metrics, an external browser will be opened with a WebGL view that renders the results in a pannable and scrollable graphic. For example, the graphic below shows individual classes in Apache Log4J 1.2.17; the highest bar selected is LogBrokerMonitor, which contains 106 methods and 36 fields. The metrics for display can include number of methods (or fields as width/length), the number of commits (if the project is connected to a team shared project in Eclipse) or the number of tests succeeded/failed/coverage (if the project has a jacoco coverage report with a jacoco.xml file). More information about the project is available at the marketplace entry.

Regular Expressions

Annotations. JavaParser. Java Tutorial - Java Annotations. Annotations embeds supplemental information into a source file. An annotation does not change the semantics of a program. An annotation is created through a mechanism based on the interface. The following code declares an annotation called MyAnno: // A simple annotation type. @interface MyAnno { String str();/* w w w.j a v a 2s .co m*/ int val(); } @ precedes the keyword interface.

All annotations have method declarations only. Note All annotation types automatically extend the Annotation interface. Any type of declaration can have an annotation associated with it. When you apply an annotation, you give values to its members. // Annotate a method. This annotation is linked with the class Main. Java Annotation retention policy A retention policy determines at what point an annotation is discarded. Java defines three such policies:SOURCE, CLASS, and RUNTIME. SOURCE is retained only in the source file and is discarded during compilation. @Retention Its general form is shown here: Java Properties file examples. Normally, Java properties file is used to store project configuration data or settings.

In this tutorial, we will show you how to read and write to/from a properties file. 1. Write to properties file Set the property value, and write it into a properties file named package; import;import;import;import java.util.Properties; public class App { public static void main(String[] args) { Properties prop = new Properties(); OutputStream output = null; try { output = new FileOutputStream(""); prop.setProperty("database", "localhost"); prop.setProperty("dbuser", "mkyong"); prop.setProperty("dbpassword", "password");, null); } catch (IOException io) { io.printStackTrace(); } finally { if (output ! Output dbpassword=password database=localhost dbuser=mkyong 2. Load a properties file from the file system and retrieved the property value.

Java Properties File: How to Read Values in Java? • Crunchify. Method to dynamically load java class files. Access properties file programatically with Spring? The Rise and Fall of Thinking Machines, Bankruptcy Article. Drools Expert User Guide. The Conditional Element from enables users to specify an arbitrary source for data to be matched by LHS patterns. This allows the engine to reason over data not in the Working Memory. The data source could be a sub-field on a bound variable or the results of a method call. It is a powerful construction that allows out of the box integration with other application components and frameworks. One common example is the integration with data retrieved on-demand from databases using hibernate named queries. The expression used to define the object source is any expression that follows regular MVEL syntax. Therefore, it allows you to easily use object property navigation, execute method calls and access maps and collections elements.

Here is a simple example of reasoning and binding on another pattern sub-field: rule "validate zipcode" when Person( $personAddress : address ) Address( zipcode == "23920W") from $personAddress then // zip code is ok end There are several ways to address this issue: