Hot questions for Using Ubuntu in javac


I start with JavaCard Development in JavaCard 2.2.2 on Linux. The Java Class is build with Java 1.5 as it's the standard for JC 2.2.2. When trying to convert the class to CAP File with the following command, the script doesn't work becaus e of the following error. Even when giving explicit path to the file .

sudo ./converter  -out CAP -exportpath /javacard/java_card_kit-2_2_2/api_export_files/javacard/framework/javacard/framework.exp -classdir ~/Documents/work/smartcards/hello_smartcard/out/production/hello_smartcard/ hello_smartcard 0x01:0x01:0x01:0x01:0x01 1.0 

error: export file framework.exp of package javacard.framework not found.


I looked deeper into the given code and found that the error occurs on the following Line of code:

JAVA_HOME/bin/java $JFLAGS com.sun.javacard.converter.Converter "$@"


Find the answer myself, with the help of this one:

create File called hello_smartcard.opt

-out EXP JCA CAP -exportpath /javacard/java_card_kit-2_2_2/api_export_files -classdir /home/florian/Documents/work/smartcards/hello_smartcard/src/ -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1 hello_smartcard hello_smartcard 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0

create CAP from config

/javacard/java_card_kit-2_2_2/bin/converter -config hello_smartcard.opt 

create ADPU Commands with scriptgen

/javacard/java_card_kit-2_2_2/bin/scriptgen javacard/hello_smartcard.cap -o javacard/hello_smartcard.gen


I am trying to follow the setup of this application:

And when I came to this part:

To build the client emulator, change into the Client directory and run make. This will create rubbos_client.jar which will be used to run the benchmark.

When I run make, I receive this error:

root@webserver:/home/user/RUBBoS/Client# make
/bin/javac -deprecation -classpath .:/lib/j2ee.jar:/jre/lib/rt.jar edu/rice/rubbos/client/
make: /bin/javac: Command not found
make: *** [edu/rice/rubbos/client/URLGenerator.class] Error 127

New error:

/opt/jdk1.7.0_80/bin/javac -deprecation -classpath .:/lib/j2ee.jar:/opt/jdk1.7.0_80/jre/lib/rt.jar edu/rice/rubbos/client/
make: /opt/jdk1.7.0_80/bin/javac: Command not found
make: *** [edu/rice/rubbos/client/URLGenerator.class] Error 127


You need to set your JAVA_HOME environment variable to your JDK installation directory.

The Makefile in the Client directory includes ../ which sets the JAVAC variable as

JAVAC = $(JAVA_HOME)/bin/javac

If JAVA_HOME is empty, you get /bin/javac which is what you observe.

For bash like shells, use something like

$ export JAVA_HOME=/opt/jdk1.7.0_80
$ make

Modify the path (/opt/jdk1.7.0_80) according to where you have installed the JDK.

Note that there is also a J2EE_HOME environment variable which you also must set to your application server home - otherwise you will get an invalid classpath (see /lib/j2ee.jar in the make output in the question)


I'm on windows 10 and running the bash shell (ubuntu), by turning the Windows Subsystem for linux on. Anyways, I'm trying to run some Java programs through the command prompt. I have already set the PATH variables and I can successfully run the java and javac commands in the windows command prompt. However, when I run the javac or java command using Ubuntu shell it says those commands are not found? So it lists some options that I can enter and one of those is

sudo apt install openjdk-8-jdk-headless

But when I run this command it says:

E: Unable to locate package openjdk-8-jdk-headless

I don't get it. I already have Java-8 installed and the PATH variables set, it works fine for the windows command prompt but fails to work with ubuntu. What am I doing wrong?



Do you have to use the OpenJDK version? Try this

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

See this link and this issue