i configured mine to be used by using dedicated specific profile, here is the part from my pom.
<profiles>
<profile>
<id>myTest</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<mainClass>com.mytest.Test</mainClass>
<!-- below are the command line parameters separated -->
<arguments>
<argument>0</argument>
</arguments>
<!-- for example -Dcom.blabla=1 put it under system properties with key and value -->
<systemProperties>
<systemProperty><key>com.blabla</key><value>1</value></systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
hope it helps.
Dor
Showing posts with label java. Show all posts
Showing posts with label java. Show all posts
Aug 27, 2014
Jun 19, 2014
Set up gradle to build with alternative java
I am using ubuntu 14.04 LTS
Having java 7 and 8 installed from oracle.
Using alternative and working with java 7 but one of my projects use java 8.
gradle build --version
returns that it works with java 7 -> since most of my projects use this version, i don't want to change this.
Solution: creating in the java 8 project, in the root directory, file named gradle.properties
inside it for example in my case :
org.gradle.java.home=/usr/lib/jvm/java-8-oracle/
this way, when you will do gradle build in this project, gradle will use this version instead of the one defined for him.
Hoped it helped,
Dor
Having java 7 and 8 installed from oracle.
Using alternative and working with java 7 but one of my projects use java 8.
gradle build --version
returns that it works with java 7 -> since most of my projects use this version, i don't want to change this.
Solution: creating in the java 8 project, in the root directory, file named gradle.properties
inside it for example in my case :
org.gradle.java.home=/usr/lib/jvm/java-8-oracle/
this way, when you will do gradle build in this project, gradle will use this version instead of the one defined for him.
Hoped it helped,
Dor
Dec 27, 2010
Websphere dump file analyaze
Download this file ha408.jar
Then run it using this command line for example:
"java -Xmx1200m -jar ha408.jar"
* The Xmx can be also 1024 or 512 it depends.
Than after the application is running, you can open the "*.phd" files from websphere to analyze.
Dor
Then run it using this command line for example:
"java -Xmx1200m -jar ha408.jar"
* The Xmx can be also 1024 or 512 it depends.
Than after the application is running, you can open the "*.phd" files from websphere to analyze.
Dor
Dec 23, 2010
load certificates in java
Just add this line below to your context listener for example.
System.setProperty("javax.net.ssl.trustStore", "c:/certificates/certificates_storage_file");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
Simple as that.
Dor
System.setProperty("javax.net.ssl.trustStore", "c:/certificates/certificates_storage_file");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
Simple as that.
Dor
Nov 23, 2010
Eclipse is running in a JRE, but a JDK is required
Hi,
1) Right click on windows eclipse shortcut.
2) add in the end of the Target "-vm pathtojdkliberary"
3) Ensure that the JRE library is setup correctly within eclipse->preferences->JRE
Solution refers both to MyEclipse (not matter if its the Blue version or the regular) and Eclipse.
That's it.
Dor
1) Right click on windows eclipse shortcut.
2) add in the end of the Target "-vm pathtojdkliberary"
3) Ensure that the JRE library is setup correctly within eclipse->preferences->JRE
Solution refers both to MyEclipse (not matter if its the Blue version or the regular) and Eclipse.
That's it.
Dor
JSON to java object, Java object to JSON
Hi,
Using the ObjectMapper from Codehaus to convert java object into json and the opposite direction, from json to java object.
Java object to JSON, code example:
OutputStream outputStream = new ByteArrayOutputStream();
new ObjectMapper().writeValue(outputStream , obj);
return outputStream .toString();
JSON to Java object, code example:
new ObjectMapper().readValue(jsonStr, Person.class);
Notes:
1. Don't forget to handle exceptions that might occur when converting using the jackson mapper.
2. Consider using / creating the mapper once as static for wide application usage.
3. The code above is an example, exception handling needed in real code.
Good day,
Dor
Using the ObjectMapper from Codehaus to convert java object into json and the opposite direction, from json to java object.
Java object to JSON, code example:
OutputStream outputStream = new ByteArrayOutputStream();
new ObjectMapper().writeValue(outputStream , obj);
return outputStream .toString();
JSON to Java object, code example:
new ObjectMapper().readValue(jsonStr, Person.class);
Notes:
1. Don't forget to handle exceptions that might occur when converting using the jackson mapper.
2. Consider using / creating the mapper once as static for wide application usage.
3. The code above is an example, exception handling needed in real code.
Good day,
Dor
Axis2 WSDL2Java to work with Salesforce API
Hi All,
After drilling down the web i have found a several ways to generate the java classes from Salesforce wsdl. I decided to publish this because i had enought.
I am using the partner.wsdl from salesforce, Myeclipse 6.5, and maven.
This what i have found, if you have anything to say write a comment, its important:
Don't forgot the add the axis2 directory to you path.
1) %AXIS2_HOME%\bin\wsdl2java -Eofv -g -uw -u -uri c:\salesforces\partner.wsdl -o c:\salesforce\generate -p com.test.salesforce
2) %AXIS2_HOME%\bin\wsdl2java -uri c:\salesforce\partner.wsdl -l java -d xmlbeans -p com.test.salesforce -sn SforceService -o c:\salesforce\generate
Bye,
Dor
After drilling down the web i have found a several ways to generate the java classes from Salesforce wsdl. I decided to publish this because i had enought.
I am using the partner.wsdl from salesforce, Myeclipse 6.5, and maven.
This what i have found, if you have anything to say write a comment, its important:
Don't forgot the add the axis2 directory to you path.
1) %AXIS2_HOME%\bin\wsdl2java -Eofv -g -uw -u -uri c:\salesforces\partner.wsdl -o c:\salesforce\generate -p com.test.salesforce
2) %AXIS2_HOME%\bin\wsdl2java -uri c:\salesforce\partner.wsdl -l java -d xmlbeans -p com.test.salesforce -sn SforceService -o c:\salesforce\generate
Bye,
Dor
Labels:
API,
axis,
axis2,
java,
salesforce,
webservice,
wsdl,
xmlbeans
Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Hi,
This exception might occur in:
1) Your key store file is corrupt and you should create it again.
(send a post if you need any help)
2) Your application failed loading the certificates key store (mentioned above).
Hoped i helped,
Dor
This exception might occur in:
1) Your key store file is corrupt and you should create it again.
(send a post if you need any help)
2) Your application failed loading the certificates key store (mentioned above).
Hoped i helped,
Dor
bad major version at offset=6
Hi,
Mainly happens or appears when you have a different java versions installed in your IDE / Server.
Try to be consist with the versions you are working with or compiling with or working in the server you have.
Bye,
Dor
Mainly happens or appears when you have a different java versions installed in your IDE / Server.
Try to be consist with the versions you are working with or compiling with or working in the server you have.
Bye,
Dor
Why i need the serialVersionUID?
Hi,
So many times i have been asked "what's for", "why i need it". It is very that you add this static variable to you class. The reason is simple, run time calculation cost for computing this UID can result in unexpected class exception, performance etc.
The object is needed for serialization process and deserialization.
I recommend you also to read http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html.
Regards,
Dor
So many times i have been asked "what's for", "why i need it". It is very that you add this static variable to you class. The reason is simple, run time calculation cost for computing this UID can result in unexpected class exception, performance etc.
The object is needed for serialization process and deserialization.
I recommend you also to read http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html.
Regards,
Dor
read heap dump
I suggest using eclipse MAT plug in, which can be found here.
After installing the plug in, use file->Open and open the heap.bin you have created (jmap for example).
It will take a while, depends on your computer hardware, but in the end, you would be able to analyaze this memory dump.
Hopefully it helps,
DOr
After installing the plug in, use file->Open and open the heap.bin you have created (jmap for example).
It will take a while, depends on your computer hardware, but in the end, you would be able to analyaze this memory dump.
Hopefully it helps,
DOr
Subscribe to:
Posts (Atom)