Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Program working perfectly in Netbeans, but not once compiled (probably a charset problem)

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Program working perfectly in Netbeans, but not once compiled (probably a charset problem)

    Hi all,

    I'v been coding myself a little program for a while now, which uses a lot of different encryption algorithms and salts, of which some i coded myself, in a random order. This works like a gem, when it runs in Netbeans, but once i compile it to a .jar file, and try it, it breaks. (encrypted text cannot be fully decrypted, and some of the letters are unreadable).
    This is what i deducted so far:
    * All the encryption algorithms separately are working perfect. They can be stored in a string object, and decrypted from there again, without problem.
    * All the binary encryptions (aes, twofish, serpent etc) work perfectly, even after compiling

    My guesses: when encrypting a character with xor, cesar, etc, there might be this problem:
    char: 0101 1001
    pass: 1100 1011 xor
    result:1001 0010
    some char encodings don't use the first bit of the byte, therefor resulting in a different char then intended.

    Some other info about my code:
    To get a random order of encryptions and salts, a randomizer makes a random order of 4 encryptions. Each of those has a binary number (00, 01, 10 and 11), which is put in that order into a char, that is added in the string, after applying those encryptions/salts. (again, the problem with the first bit might apply here as well, if that is the problem)

    I think the problem might be that the standard charset in Netbeans might not be the same as in Windows (for example UTF-8 vs EBCDIC) and that the Java virtual machine uses the charset of Windows, once the program is compiled.

    Does anyone have an idea of what the problem might be and how to solve it?

    Thanks in advance,

    PidgeyL


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Program working perfectly in Netbeans, but not once compiled (probably a charset problem)

    Can you make a small simple program that compiles, executes and shows the problem?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Program working perfectly in Netbeans, but not once compiled (probably a charset problem)

    Do you mean filling it with System.out.println's? I did that, i'll show you an example of an output:
    Here is the "proof" that the encryption methodes work seperately (these are only the string encryptions) Link
    Here is the output of the encrypting and decrypting: Link
    I added a red line to indicate where the output from the encrypting stopped and where the decrypting started

  4. #4
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Program working perfectly in Netbeans, but not once compiled (probably a charset problem)

    Do you mean console output of what happens? Compiling does not give errors (only a warning that BASE64 may be removed in future versions) I have two console outputs i made for checking, i'll list them here:
    Encrypting and decrypting: imgur: the simple image sharer ( red line indicates the end of the encrypting output and the start of the decrypting output)
    "proof" that all separate encryptions work: imgur: the simple image sharer

  5. #5
    Junior Member
    Join Date
    Mar 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Program working perfectly in Netbeans, but not once compiled (probably a charset problem)

    Do you mean console output of what happens? Compiling does not give errors (only a warning that BASE64 may be removed in future versions) I have two console outputs i made for checking, i'll list them here:
    Encrypting and decrypting: imgur: the simple image sharer ( red line indicates the end of the encrypting output and the start of the decrypting output)
    "proof" that all separate encryptions work: imgur: the simple image sharer

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Program working perfectly in Netbeans, but not once compiled (probably a charset problem)

    Your posts with links required approval.

    Please copy the contents of the messages and paste them here. Don't post links to images.

    On windows: To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Interactions problem with compiled program
    By Comp in forum Java Theory & Questions
    Replies: 1
    Last Post: September 26th, 2012, 07:25 PM
  2. Working when runned from netbeans not when compiled
    By Jedan_covik in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: September 8th, 2012, 11:23 AM
  3. no error when compiled but when the program runs .. help this !!!
    By izzahmed in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 8th, 2011, 08:55 AM
  4. Program compiled/ran as required - FAILED project WHY??????????
    By MISSAJ in forum What's Wrong With My Code?
    Replies: 7
    Last Post: June 23rd, 2010, 03:35 PM
  5. JDBCrealm FORM based problem. But BASIC working perfectly alright!
    By salman4u in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: January 27th, 2010, 09:06 PM

Tags for this Thread