Java show classes and jars that are loaded by using this jvm option:
-verbose:class
Showing posts with label java. Show all posts
Showing posts with label java. Show all posts
Tuesday, June 6, 2017
With spring, call any java code from applicationcontext.xml via expressions and while creating beans.
I found that arbitrary java can be called with spring from the applicationcontext.xml file.
See these:
https://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html
https://stackoverflow.com/questions/11645477/how-to-store-password-as-encrypted-in-properties-file-in-spring
For example:
See these:
https://docs.spring.io/spring/docs/current/spring-framework-reference/html/expressions.html
https://stackoverflow.com/questions/11645477/how-to-store-password-as-encrypted-in-properties-file-in-spring
For example:
<property name="password" value="#{T(blah.myEncryption).decrypt('${whereever.props.are.stored.password}')}" />
Monday, March 14, 2016
Maven antrun java.io.IOException: "Cannot run program" because "The filename or extension is too long"
There is an issue on where the command that maven antrun fails to run a java because the command line is too long.
In my case the classpath was way too long.
To fix it the classpath needs to be written to a manifest in a jar file and that needs to be used by java to get the classpath.
Here is an example of how to do it:
In my case the classpath was way too long.
To fix it the classpath needs to be written to a manifest in a jar file and that needs to be used by java to get the classpath.
Here is an example of how to do it:
<manifestclasspath property="manifest.classpath"
jarfile="target/classpathSupplier.jar"
maxParentLevels="99"> <classpath refid="maven.compile.classpath" /> </manifestclasspath>
<!-- Create pathing Jar --><jar destfile="target/classpathSupplier.jar"> <manifest> <attribute name="Class-Path" value="${manifest.classpath}"/> </manifest> </jar>
<java classname="org.me.ClassToRun" fork="yes" failonerror="true"> <arg value="-someArg" />
<!--<jvmarg value="-Xdebug"/>-->
<!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>--> <classpath> <pathelement location="target/classpathSupplier.jar"/> </classpath> </java>
Thursday, February 18, 2016
Look into jar files using Windows Explorer
I sometimes want to look inside of jar files, and have been copying then to .zip and then using windows explorer to look inside them. I just found out you can do this in a Admin Console:
assoc .jar=CompressedFolder
After which you can double click on a jar file in explorer and it gives you the choice to run it or open it explorer which then lets you look inside.
assoc .jar=CompressedFolder
After which you can double click on a jar file in explorer and it gives you the choice to run it or open it explorer which then lets you look inside.
Tuesday, September 1, 2015
Java -jar debug with -Xdebug
I had trouble attaching when running a jar via:
java -jar
Seems like all the param after -jar are parameters to it.
So I had to put the -Xdebug _before_ the -jar flag.
java -jar
Seems like all the param after -jar are parameters to it.
So I had to put the -Xdebug _before_ the -jar flag.
Wednesday, August 19, 2015
Java FAQ
Remote Debugging, what to add on the command line to allow it:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
Tuesday, August 18, 2015
Java executable JAR: What class does it run?
I wanted to unpack a jar file and run it so I could tweak some properties.
I found I had to use jar to unpack it (zip had name collisions).
After unpacking look here to find out what class to run:
META-INF/MANIFEST.MF
Look at the value of:
Main-Class:
It is the class to run.
Just use java to run it:
java -cp PATH_TO_UNPACKED_FILES FULLY_QUALIFIED_PATH_OF_CLASS_TO_RUN
I found I had to use jar to unpack it (zip had name collisions).
After unpacking look here to find out what class to run:
META-INF/MANIFEST.MF
Look at the value of:
Main-Class:
It is the class to run.
Just use java to run it:
java -cp PATH_TO_UNPACKED_FILES FULLY_QUALIFIED_PATH_OF_CLASS_TO_RUN
Monday, August 3, 2015
Installing the JDK and maven on Ubuntu Server
This worked for me:
sudo apt-get install maven
sudo apt-get install openjdk-7-jdk
Or was it in the opposite order?
Reference:
http://askubuntu.com/questions/117189/apt-get-install-openjdk-7-jdk-doesnt-install-javac-why
Subscribe to:
Posts (Atom)