JAVA & YUN

Latest version is JamVM 2.0.0, released on 30th July 2014. JamVM is compatible with the class-library from OpenJDK 6, 7 and 8 (the latest).

http://jamvm.sourceforge.net/

http://www.gnu.org/software/classpath/

I backport jamvm and classpath to current version.

First remove old one if it is installed.

opkg remove jamvm
opkg remove classpath
cd /mnt/sda1
wget -O  classpath_0.99-1_ar71xx.ipk https://www.dropbox.com/s/fgijxd8o8pmn2x1/classpath_0.99-1_ar71xx.ipk?dl=0 --no-check-certificate
wget -O  jamvm_2.0.0-1_ar71xx.ipk https://www.dropbox.com/s/r3vova5k09lmft1/jamvm_2.0.0-1_ar71xx.ipk?dl=0 --no-check-certificate
opkg install classpath_0.99-1_ar71xx.ipk
opkg install jamvm_2.0.0-1_ar71xx.ipk

Test jamvm installation.

root@Arduino:~# jamvm -version
java version "1.5.0"
JamVM version 2.0.0
...
Execution Engine: direct-threaded interpreter with stack-caching
Compiled with: gcc 4.6.3 20120201 (prerelease)

Boot Library Path: /usr/lib/classpath
Boot Class Path: /usr/share/jamvm/classes.zip:/usr/share/classpath/glibj.zip

Hello World example :

At Linux box:

sonnyyu@debian75386240:~/test$ java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~deb7u1)
OpenJDK Server VM (build 24.75-b04, mixed mode)
nano HelloWorld.java
class HelloWorld
{
   public static void main(String args[])
   {
      System.out.println("Hello World");
   }
}

compile HelloWorld.class file

 javac HelloWorld.java

copy HelloWorld.class into Yun

root@Arduino:/mnt/sda1# jamvm HelloWorld
Hello World

Create PDF file of US flag.

http://pdfjet.com/net/examples/example-01.html

compile Example_01.java file into Example_01.class at Linux box ( copy PDFjet.jar into same directory)

javac -classpath .:PDFjet.jar  Example_01.java

Test it at same box

java -classpath .:PDFjet.jar Example_01

copy Example_01.class file into Yun:

jamvm -classpath .:PDFjet.jar Example_01

Example_01.pdf is here

https://www.dropbox.com/s/ilcxfz9i90z3j54/Example_01.pdf?dl=0

SonnyYu, Does the dropbox belong to you? If no, how do you find? If yes, do you have more? I see you make example many times. :)

TIA Jesse

jessemonroy650:
SonnyYu,
Does the dropbox belong to you?
If no, how do you find?
If yes, do you have more? I see you make example many times. :slight_smile:

TIA
Jesse

https://www.dropbox.com/en/help/73

sonnyyu: https://www.dropbox.com/en/help/73

SonnyYu, Sorry I am not clear. I know dropbox. I hate dropbox. I do not like dropbox.

I ask about the updated packages you always make post about. Can you give details about packages? Did you make (compile) updated packages? Did you make more updated packages? How many other updated packages did you make?

TIA Jesse

I ask about the updated packages you always make post about.

Last few packages are not updated but backported, The source is in trunk.

Can you give details about packages?

Linux user space package host by package holder, I will updated my post put url in.

Did you make (compile) updated packages?

Yes.

Did you make more updated packages?

Not realy, AR71XX hardware platform is old.

How many other updated packages did you make?

Not much.

JDBC connect with DB(MYSQL):

http://dev.mysql.com/downloads/connector/j/

At Linux Box:

nano JDBCExample.java
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;

public class JDBCExample {

  public static void main(String[] argv) {

    System.out.println("-------- MySQL JDBC Connection Testing ------------");

    try {
        Class.forName("com.mysql.jdbc.Driver");
    } catch (ClassNotFoundException e) {
        System.out.println("Where is your MySQL JDBC Driver?");
        e.printStackTrace();
        return;
    }

    System.out.println("MySQL JDBC Driver Registered!");
    Connection connection = null;

    try {
        connection = DriverManager
        .getConnection("jdbc:mysql://192.168.0.64:3306/classicmodels","root", "password");

    } catch (SQLException e) {
        System.out.println("Connection Failed! Check output console");
        e.printStackTrace();
        return;
    }

    if (connection != null) {
        System.out.println("You made it, take control your database now!");
    } else {
        System.out.println("Failed to make connection!");
    }
  }
}
javac -classpath .:mysql-connector-java-5.1.34-bin.jar JDBCExample.java

java  -classpath .:mysql-connector-java-5.1.34-bin.jar  JDBCExample

copy mysql-connector-java-5.1.34-bin.jar and JDBCExample.class into Yun.

root@Arduino:/mnt/sda1# jamvm  -classpath .:mysql-connector-java-5.1.34-bin.jar
 JDBCExample
-------- MySQL JDBC Connection Testing ------------
MySQL JDBC Driver Registered!
You made it, take control your database now!

JDBC connect with MSSQL:

Download jtds-1.2.8.jar

http://sourceforge.net/projects/jtds/files/jtds/

At Linux Box:

nano DemoJdbcRowSet.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.rowset.JdbcRowSet;
public class DemoJdbcRowSet {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  try {
   //import driver
   Class.forName("net.sourceforge.jtds.jdbc.Driver");
   //connection to database
   Connection conn=DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.0.100:1433;databaseName=test;user=sa;password=password;");
   Statement state=conn.createStatement();
   String sql="SELECT * FROM areacode where id=1";
   ResultSet result=state.executeQuery(sql);
   while (result.next())
   {
    System.out.println(result.getString("id")+"\t"+result.getString("areacode"));
   }
  } catch (ClassNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (SQLException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } 
 }
}
javac -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet.java
java -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet

copy jtds-1.2.8.jar and DemoJdbcRowSet.class into Yun.

root@Arduino:/mnt/sda1# jamvm  -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet
1       354

sonnyyu: JDBC connect with MSSQL:

Download jtds-1.2.8.jar

http://sourceforge.net/projects/jtds/files/jtds/

At Linux Box:

nano DemoJdbcRowSet.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.rowset.JdbcRowSet;
public class DemoJdbcRowSet {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  try {
   //import driver
   Class.forName("net.sourceforge.jtds.jdbc.Driver");
   //connection to database
   Connection conn=DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.0.100:1433;databaseName=test;user=sa;password=password;");
   Statement state=conn.createStatement();
   String sql="SELECT * FROM areacode where id=1";
   ResultSet result=state.executeQuery(sql);
   while (result.next())
   {
    System.out.println(result.getString("id")+"\t"+result.getString("areacode"));
   }
  } catch (ClassNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (SQLException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } 
 }
}
javac -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet.java
java -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet

copy jtds-1.2.8.jar and DemoJdbcRowSet.class into Yun.

root@Arduino:/mnt/sda1# jamvm  -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet
1       354

This also does not work on the current version of Yun ((((((