Главная » soft, programming » Programming » Java experience

Java experience

find . -type f -print0 | xargs -0 sed -i ‘s/com.hp.example/local.kdiv.spring32example/g’
========================================================================
add

to $CATALINA_HOME/conf/tomcat-users.xml
======================================================================
or

======================================================================
$cat /etc/env.d/99local
PATH=$PATH:/home/kdiv/SOFT/apache-maven-3.2.1/bin

===============================================================================
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar
===============================================================================
популярный вопрос:
interface I {
public function F();
public function say();
}

abstract class A implements I {
function say() {
echo ‘Hello’;
}
// function F() — не реализована
}
==================================================
WORK WITH DATES:
==================================================
private static class TimeX {

Вот это
Calendar now = Calendar.getInstance();
active = now.after(TIME_X_START_DATE);

заменить этим
Date now = new Date();
active = now.compareTo(TIME_X_START_DATE.getTime()) >= 0;

по причине:

public GregorianCalendar(TimeZone zone, Locale aLocale) {
super(zone, aLocale);
gdate = (BaseCalendar.Date) gcal.newCalendarDate(zone);
setTimeInMillis(System.currentTimeMillis());
}

public Date() {
this(System.currentTimeMillis());
}
————————————————————
function iniaFormat(element){
var iniaInputElt = element;
var value = iniaInputElt.value;
var length = value.length;
var reg1 = new RegExp(‘([\\d]{3})’);
var reg2 = new RegExp(‘([\\d]{3}).?([\\d]{3})’);
var reg3 = new RegExp(‘([\\d]{3}).?([\\d]{3}).?([\\d]{3})’);
var reg4 = new RegExp(‘([\\d]{3}).?([\\d]{3}).?([\\d]{3}).?([\\d]{2})’);

if(length = 4) && (length = 8) && (length = 12) && (length Manifest.txt
jar cfm Project.jar Manifest.txt *.class *.java
….
java -cp[-cfe] Project.zip Project[.class]
========================================================================================

javac -classpath .;org.apache.ant.jar MyClass
java -classpath .;org.apache.ant.jar MyClass

=========================================================================================
http://www.programcreek.com/2012/05/parse-html-in-java/
=============================================================================
compile in package
javac MyPack/AccountBalance.java
java MyPack.AccountBalance
=============================================================================

How to run a class from Jar which is not the Main-Class in its Manifest file

Run
javac -cp src/external/myfile.jar Reporter.java
java -cp .:src/external/myfile.jar Reporter

java -cp MyJar.jar com.mycomp.myproj.AnotherClassWithMainMethod

=============================================================================
java -cp /usr/local/jar/foobar.jar:/some/other/path.jar com.your.main.classname
====================
On Windows you need to use ‘;’ instead of ‘:’ —
=============================================================================
https://kdiv.wordpress.com/2014/11/10/java-exp-2-experience/

======================================================================================http://stackoverflow.com/questions/29429976/how-to-convert-a-java-or-a-jar-file-into-a-linux-executable-file-without-a

sudo apt-get install gcj-jdk
gcj myFile.jar -o newNameofTheFile --main=theMainClassNameofTheFile

or

cat stub.sh helloworld.jar > hello.run && chmod +x helloworld.run 


#!/bin/sh
MYSELF=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0"
java=java
if test -n "$JAVA_HOME"; then
java="$JAVA_HOME/bin/java"
fi
exec "$java" $java_args -jar $MYSELF "$@"
exit 1

https://coderwall.com/p/ssuaxa/how-to-make-a-jar-file-linux-executable
http://www.jar2exe.com/downloads
====================================================
# To enable remote debugging uncomment the following line.# You will then be able to use a java debugger on port 4999
export JAVA_OPTS=»-Xdebug -Xrunjdwp:transport=dt_socket,address=4999,server=y,suspend=n
в /etc/init.d/tomcat
в дебаг моде
=====================================================
tail -f /usr/local/tomcat/logs/catalina.out | sed ‘s#INFO#\x1b[33m&#; s#ERROR#\x1b[31m&#; s#FATAL#\x1b[31m&#; s#DEBUG#\x1b[32m&#; s#SM-AUTH-FILTER#\x1b[0m&#; s#TrackEnsure.war has finished#\x1b[34m&#;’

Реклама

Добавить комментарий

Заполните поля или щелкните по значку, чтобы оставить свой комментарий:

Логотип WordPress.com

Для комментария используется ваша учётная запись WordPress.com. Выход / Изменить )

Фотография Twitter

Для комментария используется ваша учётная запись Twitter. Выход / Изменить )

Фотография Facebook

Для комментария используется ваша учётная запись Facebook. Выход / Изменить )

Google+ photo

Для комментария используется ваша учётная запись Google+. Выход / Изменить )

Connecting to %s