Skip to main content Skip to local navigation

Update to VPL for Java on EECS at YorkU

Update to VPL for Java on EECS at YorkU

The VPL server in the YorkU EECS department was recently updated (2022/23). This had a small impact on existing VPL scripts. With Java, any script that uses JUnit needs to have its vpl_run.sh and vpl_evaluate.sh scripts updated.

Here, I have the run script do the JUnit test directly. The evaluate script does JUnit through the main class and adds in the "grade" and "comment" signals to be sent to eClass to register the grade in the students' grade books.

This is the updated vpl_run.sh script:

#!/bin/bash
#load common script and check programs
# vpl_run_JDK17_Works_Jan2023.sh

. common_script.sh
check_program javac
check_program java
get_source_files java

#compile all .java files

# updated Jan 2023:
# tcsh (on indigo)
# setenv CLASSPATH /eecs/local/pkg/junit/junit.jar
# bash (on VPL)
export CLASSPATH=$CLASSPATH:/eecs/local/pkg/junit/junit.jar
export CLASSPATH=$CLASSPATH:/eecs/local/pkg/junit/hamcrest-core.jar

#javac *.java
/eecs/local/pkg/jdk17/bin/javac -J-Xmx16m -Xlint:deprecation *.java

if [ "$?" -ne "0" ] ; then

  echo "Not compiled"
  exit 0

fi


cat common_script.sh > vpl_execution
# updated Jan 2023:
# Version 1 (run): Just does the unit test... bypasses main.  doesn't pretend to assign grade.
echo "/eecs/local/pkg/jdk17/bin/java -enableassertions -cp $CLASSPATH:/eecs/local/pkg/junit/junit.jar org.junit.runner.JUnitCore MyTest" >> vpl_execution
# Version 2 (evaluate):  (Runs Main and shows comment and score... could be confusing to students.  Don't use when running.  Use during evaluate.)
#echo "/eecs/local/pkg/jdk17/bin/java -enableassertions -cp $CLASSPATH:/eecs/local/pkg/junit/junit.jar Main" >> vpl_execution

chmod +x vpl_execution

and here is the vpl_evaluate.sh script:

#!/bin/bash
#load common script and check programs
# vpl_evaluate_JDK17_Works_Jan2023.sh

. common_script.sh
check_program javac
check_program java
get_source_files java

#compile all .java files

# updated Jan 2023:
# tcsh (on indigo)
# setenv CLASSPATH /eecs/local/pkg/junit/junit.jar
# bash (on VPL)
export CLASSPATH=$CLASSPATH:/eecs/local/pkg/junit/junit.jar
export CLASSPATH=$CLASSPATH:/eecs/local/pkg/junit/hamcrest-core.jar

/eecs/local/pkg/jdk17/bin/javac -J-Xmx16m -Xlint:deprecation *.java

if [ "$?" -ne "0" ] ; then

  echo "Not compiled"
  exit 0

fi

cat common_script.sh > vpl_execution
# updated Jan 2023:
# Version 1 (run): Just does the unit test... bypasses main.  doesn't pretend to assign grade.
# echo "java -enableassertions -cp $CLASSPATH:/eecs/local/pkg/junit/junit.jar org.junit.runner.JUnitCore MyTest" >> vpl_execution
# Version 2 (evaluate):  (Runs Main and shows comment and score... could be confusing to students.  Don't use when running.  Use during evaluate.)
echo "/eecs/local/pkg/jdk17/bin/java -enableassertions -cp $CLASSPATH:/eecs/local/pkg/junit/junit.jar Main" >> vpl_execution


chmod +x vpl_execution

James Andrew Smith is a Professional Engineer and Associate Professor in the Electrical Engineering and Computer Science Department of York University's Lassonde School, with degrees in Electrical and Mechanical Engineering from the University of Alberta and McGill University.  Previously a program director in biomedical engineering, his research background spans robotics, locomotion, human birth and engineering education. While on sabbatical in 2018-19 with his wife and kids he lived in Strasbourg, France and he taught at the INSA Strasbourg and Hochschule Karlsruhe and wrote about his personal and professional perspectives.  James is a proponent of using social media to advocate for justice, equity, diversity and inclusion as well as evidence-based applications of research in the public sphere. You can find him on Twitter. Originally from Qu├ębec City, he now lives in Toronto, Canada.