While capturing local system stats I needed a way to run parallel captures The code below is still a work in progress how to can/will be done, more on that is explained below. For example: I am trying to capture CPU, Mem every second, but at the same I am also capturing my db response […]
Tag: java
Java sockets – system monitoring / server publisher process
This is part two – on how to capture and publish Solaris client performance stats. To read part one please click here. This program will retrieve the last system stats from the local SQLite DB and make it available over a socket or http connection for remote fetching. Once the program is running, just telnet […]
Java sockets – system monitoring / server capture process
Monitoring remote Solaris client’s by using Java sockets. The below configuration shows how to configure a host (Solaris or Linux), to expose local performance states in JSON using Java sockets, the stats are then collected by a remote system to crunch (graph/chart) the data. The full capture pipeline process is outline below. Note: If losing […]
Java – How to create a jar file from multiple packages
How to create a runnable jar file from multiple java packages. The below example has two packages mypkg1 & mypkg2 with the below directory structure As you can see below I have 3 java files and two packages
1 2 3 4 5 6 7 8 9 |
# pwd /tmp/prog # du -a 4 ./mypkg1/One.java 4 ./mypkg1/Two.java 16 ./mypkg1 4 ./mypkg2/Res.java 8 ./mypkg2 |
Example java main method file.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
package mypkg1; import mypkg2.Res; public class One { public static void main(String[] args) { Two two = new Two(); Res res = new Res(); System.out.println(two.Two(2, 2)); System.out.println(res.Res(4, 2)); } } |
Create a Manifest file Note: mypkg1 contains the main and […]
Java solution for – Error: Could not find or load main class
For example java package mypkg1 contains the main but I am still getting the error Error: Could not find or load main class One Full example below. mypkg1/One.java
1 2 3 4 5 6 7 8 9 10 11 12 13 |
package mypkg1; import mypkg2.Res; public class One { public static void main(String[] args) { Two two = new Two(); Res res = new Res(); System.out.println(two.Two(2, 2)); System.out.println(res.Res(4, 2)); } } |
Two.java
1 2 3 4 5 6 7 8 9 10 11 |
package mypkg1; public class Two { public int Two (int a, int b) { int c; c = a + b; return c; } } |
After compiling with javac. pwd /tmp/my_program Now lets run the program, all works
1 2 3 |
java mypkg1.One 4 6 |
But if the same is run from /
1 2 |
java /tmp/prog/mypkg1.One Error: Could not find or load main class .tmp.my_program.mypkg1.One |
The […]
JME3 and Blender howto
JME beginners howto Full walkthrue
1 |
https://www.youtube.com/watch?v=xdHRcVuLOw0&index=2&list=PLTHo3uR01soQ2ZNf5AB7k6CPLyVKt7PT7 |
1 |
http://www.gamefromscratch.com/post/2015/08/31/A-Closer-Look-at-jMonkeyEngine.aspx |
JME3 howto
1 |
https://docs.jmonkeyengine.org/beginner/hello_simpleapplication.html |
Terrain map howto
1 |
https://jmonkeyengine.github.io/wiki/jme3/beginner/hello_terrain.html |
Blender howto Blender Beginner Tutorial – Part 2: Moving, Rotating Blendor compile for Solaris (was not able to get it working)
1 |
https://wiki.blender.org/index.php/Dev:2.4/Doc/Building_Blender/Solaris |
Free blender 3d models
1 |
https://www.blender-models.com/model-downloads/buildings/ |
OpenRTS Engine
1 |
https://github.com/methusalah/OpenRTS |
jme3 help series
1 2 3 4 5 6 7 |
# JME31 Sneak Peek Install https://www.youtube.com/watch?v=y41jUpt1ZJk # 140621 GitHub First Timer https://www.youtube.com/watch?v=e3Ch2ep4YA8 https://www.youtube.com/channel/UCPeCbisQIUNg8I3KXi8WEMw/videos |
OpenGL ThinMatrix First OpenGL development # full […]
Solaris OpenGL (lwjgl-2.x) library and install
Note this works with version 2.x, version 3.x does not included the Solaris lib’s First Download the lwjgl library from sourceforge link below
1 |
http://sourceforge.net/project/showfiles.php?group_id=58488&package_id=54362&release_id=670417 |
To test the OpenGL run the below.
1 |
java -cp jar/lwjgl.jar:jar/lwjgl_test.jar:jar/lwjgl_util.jar -Djava.library.path=native/solaris org.lwjgl.test.WindowCreationTest |
Now lets test JME3 Download from git the jme (try with stable version)
1 |
git clone https://github.com/jMonkeyEngine/jmonkeyengine.git |
Now lets compile
1 2 3 4 5 6 7 8 9 |
./gradlew assemble # Wait to complete successful ./gradlew createZipDistribution ... [snip] :libDist :createZipDistribution BUILD SUCCESSFUL |
lwjgl install JME setup Offical […]
How to use libGDX with Android Studio (gradle)
First create a gradle.properties file Note: Change the ip and port below
1 2 3 4 5 6 7 8 9 10 |
systemProp.http.proxyHost=10.10.10.10 systemProp.https.proxyHost=10.10.10.10 systemProp.http.proxyPort=3120 systemProp.https.proxyPort=3120 systemProp.http.proxyUser= systemProp.http.proxyPassword= systemProp.https.proxyUser= systemProp.https.proxyPassword= systemProp.http.nonProxyHosts= systemProp.http.proxyStrictSSL=false |
Point the environment the gradle file
1 2 3 4 5 6 7 |
# Add gradle proxy settings export GRADLE_USER_HOME=/root/.gradle <pre> Now lets install libGDX in Android Studio Download the latest setup libGDX app. <pre> java -jar gdx-setup.jar |
Only change the SDK folder and pick a detestation folder. Once Download is completed Go in to Android studio and import the project
Java hashmap single key Multiple Values
Default java library
1 2 3 4 |
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; |
Google java library
1 2 3 4 |
import java.util.Set; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; |
Apache java library
1 2 3 4 |
import java.util.Set; import org.apache.commons.collections.MultiMap; import org.apache.commons.collections.map.MultiValueMap; |
Full working example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
package com.sqlitedb.examples.util.map; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * * @author Eli Kleinman */ public class TestArr { public void TestArr() { // create map to store Map<string, list<string="">> map = new HashMap<>(); List valSetOne = new ArrayList<>(); valSetOne.add("Apple"); valSetOne.add("Aeroplane"); List valSetTwo = new ArrayList<>(); valSetTwo.add("Bat"); valSetTwo.add("Banana"); valSetTwo.add("Apple"); List valSetThree = new ArrayList<>(); valSetThree.add("Joe"); valSetThree.add("Jany"); map.put("A", valSetOne); map.put("B", valSetTwo); map.put("G", valSetThree); // iterate and display values System.out.println("Fetching Keys and corresponding [Multiple] Values n"); //for (Map.Entry<string, list<string="">> entry : map.entrySet()) { map.entrySet().forEach((entry) -> { String key = entry.getKey(); List values = entry.getValue(); //System.out.println("Key = " + key); //System.out.println("All Values = " + values.size()); //System.out.println("Value zero = " + values.get(1)); //for (i values.size()) { for(int x = 0; x < values.size(); x = x + 1) { System.out.println("Key: " + key + " " + "Cur Item: " + values.get(x)); } }); } } </string,></string,> |
Refrence
Tuning Java Garbage Collection(GC)
Tuning java and GC The link below describes in great detail how to troubleshot, tune Java Garbage Collector(GC). Garbage First Garbage Collector Tuning