LUBYAGIN

hello world examples

Python
#!/usr/bin/python
# -*- coding: utf-8 -*-

import locale, sys
print 'locale.getpreferredencoding()', locale.getpreferredencoding()
print 'sys.stdout.encoding', sys.stdout.encoding

print unicode("Привет","utf-8").encode(sys.stdout.encoding) # MS-DOS console, cp866

# C:\Python27\python.exe hello.py
# locale.getpreferredencoding() cp1251
# sys.stdout.encoding None
# Привет
Download: hello.py

Java
@C:\Program Files (x86)"\Java\jre6\bin\java.exe HelloWorld.java 2> HelloWorld.log
public class HelloWorld {

	public static void main(String[] args) {
		System.out.println("Hello");
		System.out.println("Привет");
		int i = 1+1%3;
		System.out.println(i);
	}

}
java.lang.NoClassDefFoundError: HelloWorld/java
Caused by: java.lang.ClassNotFoundException: HelloWorld.java
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: HelloWorld.java.  Program will exit.
Exception in thread "main"
Download: hello.java

GNU C
@SET NAME=hello
@D:\PROGS\TDM-GCC-64\bin\gcc.exe -o %NAME%.exe %NAME%.c
@D:\PROGS\TDM-GCC-64\bin\strip.exe %NAME%.exe
@D:\UTILS\upx.exe %NAME%.exe
#include <stdio.h>

int main() {
	printf("Привет\n");
	return 0;
}
gcc.exe (tdm64-1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Download: hello.c

This code licensed under the terms of MIT/Expat license or AGPLv3 license, at your choice.