How I can delete an applet from my java card? - applet

I installed an applet on my javacard! and now I want to delete it. How I can do it?
I try "Reset Card" button in jcmanager and also gpj -delete AID but it not deleted! I also try gpshell but it don't work too. the output of gpj shown below:
note: I download the .cap file from here [section:Java Card Applet for read and write data] and here is its source code.

You are trying to delete the executable load file without deleting the applet instance installed from it. Either change the parameter P2 of the DELETE APDU to 0x80 (delete object and related object). GPJ does this if you pass the argument -deletedeps:
gpj -deletedeps -delete D2760000605002
Alternatively delete the applet instance (AID: D2 76 00 00 60 41 02) first.

DELETE command format looks ok
80E40000094F07D2760000605002
80E4000009
^^ -> CLA
^^ -> E4 :INS -> DELETE
^^ -> 00 : Reference Control Parameter P1 -> Last (or only) command
^^ -> 00 :P2 -> Delete object
^^ -> 09 :Lc -> Length of data field
4F07D2760000605002
^^ -> 4F: Tag-> Executable Load File or Application AID
^^ -> 07 : Length of Load File AID
^^^^^^^^^^^^^^ -> D2760000605002 :Load File AID
It looks Load File AID does not belong to applet which has been tried to delete.

Related

Sikuli IDE Error - javax.script.ScriptException " is not defined in nashorn:mozilla_compat.js at line number 69

I'm working on a simple Sikuli Script.
The script is simply one line shown below
click()
The following error is produced?
javax.script.ScriptException: ReferenceError: "Commands" is not defined in nashorn:mozilla_compat.js at line number 69
I believe I have all dependencies installed. Could I ask for some assistance for what else is missing to move on from this error?
You are trying to use the commands in javascript mode. Do the following: create a new tab, right click on it, select "set type" and choose "jython". Your code should now work.

WildFly - Files\Java\jdk1.7.0_40"" was unexpected at this time

I'm trying to start up WildFly 8 with a custom start.bat file that calls standalone.bat and then also a custom property file. When I run my start.bat I get this error in the command line:
C:\PWServer8>propworks_start.bat
C:\PWServer8\bin>call standalone.bat -P=../propworks/conf/propworks.properties -b 10.10.100.122
Calling "C:\PWServer8\bin\standalone.conf.bat"
Files\Java\jdk1.7.0_40"" was unexpected at this time.
I've done a search for "was unexpected at this time" within all the files in my WildFly folder but nothing turned up so I couldn't pinpoint where the error is coming from. Here is my custom start.bat and afterwards is my property file. If anyone knows what's going on it would be a big help.
propworks_start.bat
C:
cd C:\PWServer8\bin
SET JAVA_HOME="C:\Program Files\Java\jdk1.7.0_40"
call standalone.bat -P=../propworks/conf/propworks.properties -b 10.10.100.122
propworks.properties
#PROPworks Configuration Properties
#Wed Jun 18 17:18:03 EDT 2014
propworks.bind.address=10.10.100.122
propworks.database.class=Oracle10g
propworks.database.connection.sql=select 1 From Dual
propworks.database.desc=support#mcosrvorcl001
propworks.database.dialect=com.airit.propworks.server.dialect.PWOracleDialect
propworks.database.driver=oracle
propworks.database.password=-5522f65bbe2cc1c6
propworks.database.schema=uc2014
propworks.database.url=jdbc\:oracle\:thin\:#10.10.201.10\:1521\:bsdev
propworks.database.user=uc2014
propworks.http.port=8080
propworks.indb.use=NONE
propworks.jdk.home=C\:\\Program Files\\Java\\jdk1.7.0_40
propworks.messaging.port=5445
propworks.remoting.port=4447
archiver.enabled=N
orafin.database.driver=oracle
orafin.database.password=
orafin.database.user=
org.quartz.dataSource.QUARTZ.jndiURL=java\:/propworksDS
org.quartz.dataSource.QUARTZ_NO_TX.jndiURL=java\:/quartzDS
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreCMT
org.quartz.jobStore.dataSource=QUARTZ
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.nonManagedTXDataSource=QUARTZ_NO_TX
org.quartz.jobStore.selectWithLockSQL=SELECT * FROM {0}LOCKS WHERE LOCK_NAME \= ? FOR UPDATE
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.scheduler.instanceName=DefaultQuartzScheduler
org.quartz.scheduler.rmi.export=false
org.quartz.scheduler.rmi.proxy=false
org.quartz.scheduler.xaTransacted=false
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=3
org.quartz.threadPool.threadPriority=9
psfin.database.driver=oracle
psfin.database.password=
psfin.database.user=
pwarchiver.database.driver=oracle
pwarchiver.database.password=
pwarchiver.database.user=
Two solutions:
1) move java to folder that does not have spaces in it.
2) double quote path when you set it
SET JAVA_HOME=""C:\Program Files\Java\jdk1.7.0_40""
add \ similar below :
SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_40\
this is caused by the space in front of C:\Program , so what u need to do is changing your JAVA file in c:program files \java to another file without spaces , and then in top of your file write :
SET JAVA_HOME=""NEW DIRECTORY WITHOUT SPACE\Java\jdk1.7.0_40""
this worked for me.

Setting new text file line delimiter as Unix in Eclipse IDE

Eclipse Indigo Service Release 2 running on Microsoft WindowsServer 2008 R2. Now I want set "New File Line Delimiter" as Unix (or set as default for all work spaces) for all users.
How can we do this?
Workspace: Window -> Preferences -> General -> Workspace -> New text file line delimiter.
Project: Properties -> Resource -> New text file line delimiter.
The file dilimeter I was looking for separated lines of code from obvious sharp differences in the data (e.g. 1. "," , 2. ":", 3. ";" , etc.). I did find my answer using the following line of code:
String arr[ ] = line.split(",");
OR
String arr[ ] = line.split(":");

Encoding of file names in Java

I am running a small Java application on an embedded Linux platform. After replacing the Java VM JamVM with OpenJDK, file names with special characters are not stored correctly. Special characters like umlauts are replaced by question marks.
Here is my test code:
import java.io.File;
import java.io.IOException;
public class FilenameEncoding
{
public static void main (String[] args) {
String name = "umlaute-äöü";
System.out.println("\nname = " + name);
System.out.print("name in Bytes: ");
for (byte b : name.getBytes()) {
System.out.print(Integer.toHexString(b & 255) + " ");
}
System.out.println();
try {
File f = new File(name);
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Running it gives the following output:
name = umlaute-???
name in Bytes: 75 6d 6c 61 75 74 65 2d 3f 3f 3f
and file called umlaute-??? is created.
Setting the properties file.encoding and sun.jnu.encoding to UTF-8 gives the correct strings in the terminal, but the created file is still umlaute-???
Running the VM with strace, I can see the system call
open("umlaute-???", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0666) = 4
This shows, that the problem is not a file system issue, but one of the VM.
How can the encoding of the file name be set?
If you are using Eclipse, then you can go to Window->Preferences->General->Workspace and select the "Text file encoding" option you want from the pull down menu. By changing mine around, I was able to recreate your problem (and also change back to the fix).
If you are not, then you can add an environmental variable to windows (System properties->Environment Variables and under system variables you want to select New...) The name should be (without quotes) JAVA_TOOL_OPTIONS and the value should be set to -Dfile.encoding=UTF8 (or whatever encoding will get yours to work.
I found the answer through this post, btw:
Setting the default Java character encoding?
Linux Solutions
-(Permanent) Using env | grep LANG in the terminal will give you one or two responses back on what encoding linux is currently setup with. You can then set LANG to UTF8 (yours might be set to ASCII) in the /etc/sysconfig i18n file (I tested this on 2.6.40 fedora). Bascially, I switched from UTF8 (where I had odd characters) to ASCII (where I had question marks) and back.
-(on running the JVM, but may not fix the problem) You can start the JVM with the encoding you want using java -Dfile.encoding=**** FilenameEncoding
Here is the output from the two ways:
[youssef#JoeLaptop bin]$ java -Dfile.encoding=UTF8 FilenameEncoding
name = umlaute-הצ�
name in Bytes: 75 6d 6c 61 75 74 65 2d d7 94 d7 a6 ef bf bd
UTF-8
UTF8
[youssef#JoeLaptop bin]$ java FilenameEncoding
name = umlaute-???????
name in Bytes: 75 6d 6c 61 75 74 65 2d 3f 3f 3f 3f 3f 3f 3f
US-ASCII
ASCII
Here is some references for the linux stuff
http://www.cyberciti.biz/faq/set-environment-variable-linux/
and here is one about the -Dfile.encoding
Setting the default Java character encoding?
I know it's an old question but I had the same problem.
All of the mentioned solutions did not work for me, but the following solved it:
Source encoding to UTF8 (project.build.sourceEncoding to UTF-8 in maven properties)
Program arguments: -Dfile.encoding=utf8 and -Dsun.jnu.encoding=utf8
Using java.nio.file.Path instead of java.io.File
Your problem is that javac is expecting a different encoding for your .java-file than you have saved it as. Didn't javac warn you when you compiled?
Maybe you have saved it with encoding ISO-8859-1 or windows-1252, and javac is expecting UTF-8.
Provide the correct encoding to javac with the -encoding flag, or the equivalent for your build tool.

MongoDB - eclipse

I need to create a server-side app that saving information to a mongoDB ,
I'm working with java-eclipse-IDE and i have some problems with that .
First ,
I download the mongo-2.7.2.jar and add it to the path ( project ->properties-> java build path -> add jar -> (adding the mongo-2.7.2.jar file ) .
When I press "Run" without writing any other line except the empty - class & main function
The console writing me that :
CLI (1) [java application] path date
Usage : [--bucket bucketname] action
where action is one of:
list : lists all files in the store
put filename : puts the file filename into the store
get filename1 filename2 : gets filename1 from store and sends to filename2
md5 filename : does an md5 hash on a file in the db (for testing)
I tried to put a system.out.print("indications") in the main function but the console showing me the same output ...
onother interesting fact is when i'm wrting a code using a mongo DB the compiler accepted the code and not throwing errors ( seems he accepted the mongo-2.7.2.jar ).
second ,
I thoght maby i need to install a mongoDB plugin to eclipse , should i?
third ,
I saw that maven is integrated a mongoDB service , is it right that i should download maven to eclipse for handle mongoDB?
I need help soon as possible ....
Thanks.
Sounds like its trying to do something with GridFS but is missing a bucket name... are you using GridFS?