this might be a good place for you to start searching
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
the JRE is the runtime environment. when installed on your system, it allows you to run Java applications.
if you want to write your own, though, you'll need a bit more. you'll need the JDK (development kit) for that, it contains the JRE, but it also contains additional tools you'll need to develop and compile your code, like the compiler (javac)
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
nitin1: she actually already replied. read the above replies.
actually, "I want it back" might have been what triggered some of the downvotes:
1. you deleted the account on your free will
2. above was already replied a few times that there is a reason why -when doing so- you get the message:
This is an irreversible process. Posts will remain intact. Please make sure you don't want to unsubscribe from our emails instead
as HappyGeek already pointed out.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
you are using the == operator to compare Strings' values, you should use the equals method.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
my guess: you'll have to look into character encoding.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
writing the code yourself? download the .jar file containing the code?
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
my point is: have you tried on the other computer on which you want it to work?
as ~s.o.s~ says, it depends on the computer on which you'll try, so: will it work on each and every computer in the world? well, doubtful, will it work on a number of computers around you? very well possible.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
if you had tried, you would have known.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
hard to say if we don't know what type cb1 is, but if it's a String it's not:
cb1 = "director"
but
"director".equals(cb1)
if you want to compare two Objects on value, use the equals method, not the == operator, which will simply compare the references.
in this case, it's recommended to choose:
"director".equals(cb1)
over
cb1.equals("director")
for the simple reason that it is impossible for "director" to throw a NullPointerException.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
resizing using height-width in css won't change anything about the size in bytes.
maybe this can help you out.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
do you mean the size as in number of pixels, or as in number of bytes?
yes, you can either check the size, or re-size if you want it smaller.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
why don't you just do:
FileWriter foStream;
try{
foStream = new FileWriter("file1.txt");
....
}
catch(Exception e){
}
try{
foStream = new FileWriter("file2.txt");
...
}
catch(Exception e){
}
you can also put them in the same try-block.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
"I could try all the suggestions over there but they don't work"
and how do you know they don't work until you try? no, javac is not the same as javecpl. if, as you say, you don't have the JDK installed, as JamesCherrill points out.
both those links tell you to refer to the installed JDK, not the JRE, so trying them would have solved the issue. as I said: overlooking something basic is easily done.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
don't forget to catch those exceptions in your main method.
puzzled a bit with your code, and added an IvParameterSpec with which I got it to work:
here I hardcoded the value, of course it's better to have one generated, so that each encryption has it's own key.
public String encrypt(String dec) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException {
byte[] iv = { 0, 0, 0, 0, 0, 0, 0, 0 };
IvParameterSpec ivspec = new IvParameterSpec(iv);
c.init(Cipher.ENCRYPT_MODE, k, ivspec);
String enc = new String(c.doFinal(dec.getBytes()));
return enc;
}
public String decrypt(String enc) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException {
byte[] iv = { 0, 0, 0, 0, 0, 0, 0, 0 };
IvParameterSpec ivspec = new IvParameterSpec(iv);
System.out.println("k = " + k);
c.init(Cipher.DECRYPT_MODE, k, ivspec);
String dec = new String(c.doFinal(enc.getBytes()));
return dec;
}
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
why do you return null from those methods? I think it would be better to throw an Exception from the catch block, or have your method throw the exception instead of handling with it.
the main method is just a test class ... yeah well, since we don't know what code is in that 'test class', we can't really say much about it, can we?
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
for (int i = 0; i < al.size(); i++) {
String[] parts = al.get(i).split(",");
if(parts[i].indexOf(5).equals("Y"))
System.out.println(al.get(i));
}
here you were on the right track, but what exactly do you need that 'indexOf' for? just look in the api for String, and you'll see that 's not what you want at all.
at that part, you have an array of Strings of (minimal) 6 elements.
what you need to do is check whether or not the 6th element (index = 5) equals "Y", so just replace the above code with:
for (int i = 0; i < al.size(); i++) {
String[] parts = al.get(i).split(",");
if(parts[5].equals("Y"))
System.out.println(al.get(i));
}
and try again.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25
why are you not using your 'line' variable?
anyway, "doesn't display properly" doesn't really tell us much.
what I suggested was: check the element of parts with index 5. if that equals "Y", then print al.get(i), not parts with index i.
stultuske
Industrious Poster
4,493 posts since Jan 2007
Reputation Points: 1,377
Solved Threads: 630
Skill Endorsements: 25