JAVA the real stuff
Posted by kll on September 04 2019 19:25:35
currently i use the Processing 3.5.3 what is still based on JAVA 8
but Sam Pottinger just produce what might be the Processing 4 beta with JAVA 11
i play and dig and try find out what each step JAVA 8 / 9 / 10 / 11 added features are
( and what of it ended up usable in Processing )
when i asked like:
JAVA 9 introduces modules / of packages / of classesI think you are referring to JEP 261. Right now, this new version of processing will put everything into the unnamed module. I don’t think we are currently planning on supporting a pathway to leave the unnamed module through the IDE or processing-java from the CLI (though I would still advise against using module-info.java for regular development).

That said, the new module system is super nifty. If you want to take advantage of it, you’ll probably want to set up a build system (like gradle ) and leverage the new core jar in a more regular java project.



on my new Win 10 PC have now
Processing 3.5.3 (with JAVA 8)
Processing pre 4.0.0 beta (with JAVA 11)
but no JAVA install.
so i started the long way:


for ORACLE JAVA need account login ( email confirmed ), for GRADLE no problem.
and i downloaded:
jdk-11.0.4_windows-x64_bin.exe
gradle-5.6.1-all.zip
setup:







try same on the RPI
and already see a update to
gradle 5.6.2. on RPI must use:
export PATH=$PATH:/opt/gradle/gradle-5.6.2/bin



how to start? no idea
gradle.org, building-java-libraries, java_9_module
i downloaded the module example zip
here
but when i started ( from CMD ) gradlew.bat
there was a service gradle download and some JAVA version was detected but failed??



ok, start with JAVA APP
inside a new project directory: demo_java_app in cmd window:
gradle init

gradlew.bat build

gradlew.bat tasks
gradlew.bat run



but what i am actually up to is
-a- learn about making a library for processing
-b- do that with JAVA 11 for processing 400 beta ( using ?gradle? not ?eclipse? )
info and template

but first follow pure gradle way
path:
...\Gradle\demo_java_lib>
start:
gradle init

find your lib code:
...\Gradle\demo_java_lib\src\main\java\demo_java_lib\Library.java

gradlew.bat build

see report:
build/reports/tests/test/index.html

result:
build\libs\demo_java_lib.jar

check:
jar tf build/libs/demo_java_lib.jar

edit: file:
build.gradle
and add:

jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}

gradlew.bat jar

jar tf build/libs/demo_java_lib.jar

jar xf build/libs/demo_java_lib.jar META-INF/MANIFEST.MF // not show anything

gradlew.bat javadoc
see:
build/docs/javadoc/index.html




reading about IDE for JAVA programming like
* Eclipse
* NetBeans
* IntelliJ IDEA
i see a light one ( i think i have seen installed on the Raspberry Pi too / but never used..)
* BlueJ see also about
download: BlueJ-windows-421.msi
but it comes with its own version

need to learn how to switch.

first test BlueJ: ( usage of context menu on what item is confusing... )


use a good example: shapes



now i not see how to use that with a existing gradle project ? possibly this helps ?

use for processing see here and here


get eclipse-inst-win64.exe from eclipse

if you want do processing with eclipse see here


but thinking about testing the new
"possible Processing 4.0.0 beta" from Sam Pottinger
what uses the JAVA 11 ... ( works nice on Win 10 ) and building it on the RPI?
forum and forum
sampottinger
processing_build.md



sorry, again a impressive show from @monkstone
at forum
but i need to follow step by step to understand what this is about.

-A- we use processing 3.5.3 ( JAVA 8 )
in PDE / Tools / add Tool... / Libraries / add install
PixelFlow 1.3.0
Thomas Diewald PixelFlow is a Processing library for high performance GPU-Computing (GLSL),
like Fluid Simulation, SoftBody Dynamics, Rendering, Optical Flow, Image processing ..

( possibly need restart processing )
in PDE / File / Examples / Contributed Libraries / PixelFlow / Skylight / Skylight_Basic /
you see also that exact impressive picture.

-B- interludium: i want play with that SHADOW thing.
but when i save that example as a own project i get a error,
need to make copy
/data/skylight_demo_scene.obj
/data/skylight_demo_scene.mtl
and in code need now
shape = loadShape("data/skylight_demo_scene.obj");
now i want make the SUNLIGHT shadow interactive:
__
// public void keyReleased(){
//kll printCam();
// }

public void keyPressed() {
if ( key == 'p' ) printCam();
// kll add_____________________________________________________MOVE SUN
if ( key == '+' ) skylight.sun.param.solar_azimuth++;
if ( key == '-' ) skylight.sun.param.solar_azimuth--;
skylight.reset();
skylight.update();
}
__
works.

-C- also like a step back for understand the basics,
i want try to use that SCENE only, without the library
__
// to understand PixelFlow_Skylight_Basic
// need to test that scene used therein: shape = loadShape("../../data/skylight_demo_scene.obj");
PShape myshape;
int ang = 0;

void setup() {
size(500, 500, P3D);
myshape = loadShape("data/skylight_demo_scene.obj");
// expect in data/ a copy of // skylight_demo_scene.obj // skylight_demo_scene.mtl
frameRate(5); // slow show
}

void draw() {
background(200, 200, 0);
translate(width/2, height/2, 200);
rotateX(radians(ang++));
rotateY(radians(ang++));
shape(myshape, 0, 0, 200, 200);
}
__



-D- ok now we come to the question what @monkstone want to show us?
so i save that earlier copy to my SAM_POTTINGER project directory as
monkstone_PixelFlow_Skylight_Basic and try manually to follow his changes:
```
/*
// callback for rendering the scene
DwSceneDisplay scene_display = new DwSceneDisplay(){
@Override
public void display(PGraphics3D canvas) {
displayScene(canvas);
}
};
*/
DwSceneDisplay scene_display = (canvas) ->{
if(canvas == skylight.renderer.pg_render){
canvas.background(32);
}
canvas.shape(shape);
};

```
now that is the LAMBDA version he talk about and that only run in JAVA11 from the
SamPottinger Processing 4.0.0.beta
( don't think i understand that // but i am happy i was able to find it )