How to change cursor icon in Java?

Standard cursor image: setCursor(Cursor.getDefaultCursor()); User defined Image: Toolkit toolkit = Toolkit.getDefaultToolkit(); Image image = toolkit.getImage(“icons/handwriting.gif”); Cursor c = toolkit.createCustomCursor(image , new Point(mainPane.getX(), mainPane.getY()), “img”); mainPane.setCursor (c); You can download a zip containing sample source: HERE

How to check whether java is installed on the computer

if you are using windows or linux operating system then type in command prompt / terminal java -version If java is correctly installed then you will get something like this java version “1.7.0_25” Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing) Side note: After installation of Java on … Read more

Execute external program

borrowed this shamely from here Process process = new ProcessBuilder(“C:\\PathToExe\\MyExe.exe”,”param1″,”param2″).start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; System.out.printf(“Output of running %s is:”, Arrays.toString(args)); while ((line = br.readLine()) != null) { System.out.println(line); } More information here Other issues on how to pass commands here and here

about java: get `String[].class` from `String.class`, what if `String.class` is a “runtime type”? [duplicate]

HRgiger’s answer improved: @SuppressWarnings(“unchecked”) static <T> Class<? extends T[]> getArrayClass(Class<T> clazz) { return (Class<? extends T[]>) Array.newInstance(clazz, 0).getClass(); } Both of them instantiate an array object when invoked. To get the array type, use Class<?> childType = …; Class<?> arrayType = getArrayClass(childType);

How to get a JavaDoc of a method at run time?

The only way to get it at runtime is to use custom annotations. Create a custom annotation class: @Retention(RUNTIME) @Target(value = METHOD) public @interface ServiceDef { /** * This provides description when generating docs. */ public String desc() default “”; /** * This provides params when generating docs. */ public String[] params(); } Use it … Read more

Is it possible to compile and execute new code at runtime in .NET?

Yes! Using methods found in the Microsoft.CSharp, System.CodeDom.Compiler, and System.Reflection name spaces. Here is a simple console app that compiles a class (“SomeClass”) with one method (“Add42”) and then allows you to invoke that method. This is a bare-bones example that I formatted down to prevent scroll bars from appearing in the code display. It … Read more

How do I get at the goodies in my Grails Config.groovy at runtime?

In more recent versions of grails ConfigurationHolder has been deprecated. Instead you should use the grailsApplication object. grailsApplication.config.grails.serverURL If in a Controller or Service then use dependency injection of grailsApplication object. e.g. class MyController{ def grailsApplication def myAction() { grailsApplication.config.grails.serverURL } See How to access Grails configuration in Grails 2.0?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)