phetsims / decaf

PhET Java Simulations converted to HTML5 using CheerpJ
1 stars 0 forks source link

Copy all Java simulations into the repo #2

Closed samreid closed 4 years ago

samreid commented 4 years ago

By inspecting the body of https://phet.colorado.edu/en/simulations, I identified this list of Java and Flash simulations that are on our website:

Java sims

alpha-decay balloons-and-buoyancy band-structure battery-resistor-circuit battery-voltage beta-decay build-a-molecule capacitor-lab circuit-construction-kit-ac circuit-construction-kit-ac-virtual-lab collision-lab conductivity davisson-germer covalent-bonds eating-and-exercise electric-hockey efield energy-skate-park faraday fluid-pressure-and-flow forces-and-motion forces-1d fourier gene-machine-lac-operon generator glaciers greenhouse ladybug-motion-2d rotation lasers magnet-and-compass magnets-and-electromagnets maze-game membrane-channels microwaves hydrogen-atom molecular-motors motion-2d moving-man natural-selection discharge-lamps nuclear-fission optical-quantum-control optical-tweezers photoelectric plate-tectonics bound-states quantum-tunneling quantum-wave-interference radioactive-dating-game radio-waves the-ramp ramp-forces-and-motion reactions-and-rates reversible-reactions soluble-salts self-driven-particle-model semiconductor signal-circuit mri sound stretching-dna sugar-and-salt-solutions torque

Flash

buoyancy calculus-grapher collision-lab density estimation geometric-optics lunar-lander my-solar-system normal-modes radiating-charge resonance stern-gerlach

We should copy the JAR files for all of the Java simulations to this repo, probably in a sims/folder.

samreid commented 4 years ago

Eventually, we would like to use the multi-language "all" jars, but I'm not sure if we will also want to use those for the initial feasibility test. Also, we may want to rebuild the sims from source in #3.

samreid commented 4 years ago

@mattpen pointed out the all jars are located like so:

http://phet.colorado.edu/sims/nuclear-physics/nuclear-physics_all.jar

@pixelzoom pointed out the language code is specified like so:

Example: java -Djavaws.user.language="fr" -jar nuclear-physics_all.jar javaws.user.country if you need a specific country code.

samreid commented 4 years ago

Sims are organized by project, it will be simpler, easier, faster if we can leverage the "all" jars as much as possible. Here's the list organized by project:

battery-resistor-circuit/battery-resistor-circuit
battery-voltage/battery-voltage
bound-states/band-structure
bound-states/bound-states
bound-states/covalent-bonds
build-a-molecule/build-a-molecule
capacitor-lab/capacitor-lab
circuit-construction-kit/circuit-construction-kit-ac
circuit-construction-kit/circuit-construction-kit-ac-virtual-lab
conductivity/conductivity
discharge-lamps/discharge-lamps
eating-and-exercise/eating-and-exercise
efield/efield
electric-hockey/electric-hockey
energy-skate-park/energy-skate-park
faraday/faraday
faraday/generator
faraday/magnet-and-compass
faraday/magnets-and-electromagnets
fluid-pressure-and-flow/fluid-pressure-and-flow
forces-1d/forces-1d
fourier/fourier
gene-network/gene-machine-lac-operon
glaciers/glaciers
greenhouse/greenhouse
hydrogen-atom/hydrogen-atom
ideal-gas/balloons-and-buoyancy
ideal-gas/reversible-reactions
ladybug-motion-2d/ladybug-motion-2d
lasers/lasers
maze-game/maze-game
membrane-channels/membrane-channels
microwaves/microwaves
motion-2d/motion-2d
motion-series/forces-and-motion
motion-series/ramp-forces-and-motion
moving-man/moving-man
mri/mri
natural-selection/natural-selection
nuclear-physics/alpha-decay
nuclear-physics/beta-decay
nuclear-physics/nuclear-fission
nuclear-physics/radioactive-dating-game
optical-quantum-control/optical-quantum-control
optical-tweezers/molecular-motors
optical-tweezers/optical-tweezers
optical-tweezers/stretching-dna
photoelectric/photoelectric
plate-tectonics/plate-tectonics
quantum-tunneling/quantum-tunneling
quantum-wave-interference/davisson-germer
quantum-wave-interference/quantum-wave-interference
radio-waves/radio-waves
reactions-and-rates/reactions-and-rates
rotation/rotation
rotation/torque
self-driven-particle-model/self-driven-particle-model
semiconductor/semiconductor
signal-circuit/signal-circuit
soluble-salts/soluble-salts
sound/sound
sugar-and-salt-solutions
the-ramp/the-ramp
samreid commented 4 years ago

Here's a list of the unique projects:

battery-resistor-circuit
battery-voltage
bound-states
build-a-molecule
capacitor-lab
circuit-construction-kit
conductivity
discharge-lamps
eating-and-exercise
efield
electric-hockey
energy-skate-park
faraday
fluid-pressure-and-flow
forces-1d
fourier
gene-network
glaciers
greenhouse
hydrogen-atom
ideal-gas
ladybug-motion-2d
lasers
maze-game
membrane-channels
microwaves
motion-2d
motion-series
moving-man
mri
natural-selection
nuclear-physics
optical-quantum-control
optical-tweezers
photoelectric
plate-tectonics
quantum-tunneling
quantum-wave-interference
radio-waves
reactions-and-rates
rotation
self-driven-particle-model
semiconductor
signal-circuit
soluble-salts
sound
sugar-and-salt-solutions
the-ramp
pixelzoom commented 4 years ago

A few things to add to https://github.com/phetsims/cheerpj/issues/2#issuecomment-606816490...

(1) locale = language + country

A locale sometimes consists of a language code and a country code. To specify country code, use -Djavaws.user.country. For example, for Simplified Chinese (zh_CN):

java -Djavaws.user.language="zh" -Djavaws.user.country="CN" -cp nuclear-physics_all.jar edu.colorado.phet.nuclearphysics.AlphaDecayApplication

If the locale requires a country and you don't specify it, then the sim will fail to find the locale and will default to English.

(2) class-path for main

all.js files for projects with multiple flavors (sims) display a dialog to select the flavor to run. For example, there are 4 flavors in the nuclear-physics project, so:

java -jar nuclear-physics_all.jar

screenshot_235

To bypass this dialog, you'll need to specify the class that contains main. You don't want to use -jar, because it executes what's specified in the .jar manifest. Use -cp to add the jar to the classpath, then specify which class' main to run. For example, to run Alpha Decay in French (fr):

java -Djavaws.user.language="fr" -cp nuclear-physics_all.jar edu.colorado.phet.nuclearphysics.AlphaDecayApplication

(3) All -D options to jar must appear before the -cp option, or they'll be ignored.

samreid commented 4 years ago

I added all of the all JAR files, one per project. Closing, though I know I'll have to refer to https://github.com/phetsims/cheerpj/issues/2#issuecomment-606837121 in upcoming work.