Results 1 to 14 of 14
  1. #1
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Need help to compile java files to class

    Hello all,

    I need some help, i am trying for more then 2 hours to compile my edited .java files to .class files.
    But it seems it does not compile it correctly
    i made some changes to my current chat applet, edited some mysql and information and now trying to bring it back to class files with this code:

    Class-Maker.bat
    Java Code:
    Set Path=C:\glassfish3\jdk7\bin
    javac -g -sourcepath -source -verbose -Xlint:deprecation -Xlint:unchecked chatserver/container/*.java chatserver/gui/*.java chatserver/logging/*.java chatserver/main/*.java chatserver/netio/*.java chatserver/objects/*.java chatserver/roles/*.java chatserver/sql/*.java chatserver/tools/*.java
    pause
    Oke this works it creates my .class files in all paths.
    But now i got the issue, i have to put these files back to the "chatserver.jar" and now i use this command:

    Jar-Maker.bat
    Java Code:
    Set Path=C:\glassfish3\jdk7\bin
    jar -cf chatclient/chatclient.jar META-INF/Manifest.txt chatclient/applets/*.class chatclient/applets/canvas/*.class chatclient/applets/challengees/*.class chatclient/applets/components/*.class chatclient/applets/note/*.class chatclient/netio/*.class chatclient/tools/*.class 
    pause
    Manifest.txt
    Java Code:
    Class-Path: chatserver.jar
    Now it makes a jar file, but the original size of my chat applet jar file is 325KB but it recompiles it only for 50% i have 185KB what am i doing wrong :(?

    can somebody please help me?

    It makes new

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: Need help to compile java files to class

    Have you looked into the jar file to see if its contents are all there? Use a zip utility.

    I think you need to use the -m option with the jar command to properly install the manifest file into the jar.

  3. #3
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Need help to compile java files to class

    I did that but its not working, i get output file -m

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: Need help to compile java files to class

    I did that but its not working,
    Can you show the command that you used?
    Here is a command line I use:
    jar -cmf BuildDoit.mnf %DEV_HOME%\JavaDevelopment\BuildDoIt.jar BuildDoIt*.class

  5. #5
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Need help to compile java files to class

    Set Path=C:\glassfish3\jdk7\bin
    jar -cf -m chatserver.jar chatserver/META-INF/Manifest.txt chatserver/gui/*.class chatserver/logging/*.class chatserver/main/*.class chatserver/netio/*.class chatserver/objects/*.class chatserver/roles/*.class chatserver/sql/*.class chatserver/tools/*.class
    pause

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: Need help to compile java files to class

    Did you look at my sample jar.exe commandline?

  7. #7
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Need help to compile java files to class

    yes i used youre code now:

    Set Path=C:\glassfish3\jdk7\bin
    jar -cmf BuildDoit.mnf %DEV_HOME%\chatserver.jar chatserver/META-INF/Manifest.txt chatserver/gui/*.class chatserver/logging/*.class chatserver/main/*.class chatserver/netio/*.class chatserver/objects/*.class chatserver/roles/*.class chatserver/sql/*.class chatserver/tools/*.class
    pause

    it works, but i dont creates jar file?

  8. #8
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: Need help to compile java files to class

    Were there any errors? Where did you look for the .jar file?
    Copy the contents of the command prompt window for when you execute the jar command.
    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.

  9. #9
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Need help to compile java files to class

    C:\Users\Atomski-Mrav\Desktop\Output\chatserver.jar\chatserver\src> Set Path=C:\g
    lassfish3\jdk7\bin

    C:\Users\Atomski-Mrav\Desktop\Output\chatserver.jar\chatserver\src> jar -cmf Buil
    dDoit.mnf \chatserver.jar chatserver/META-INF/Manifest.txt chatserver/gui/*.clas
    s chatserver/logging/*.class chatserver/main/*.class chatserver/netio/*.class ch
    atserver/objects/*.class chatserver/roles/*.class chatserver/sql/*.class chatser
    ver/tools/*.class

    C:\Users\Atomski-Mrav\Desktop\Output\chatserver.jar\chatserver\src> pause
    Druk op een toets om door te gaan. . .

  10. #10
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: Need help to compile java files to class

    Did you create a manifest file called: BuildDoit.mnf?
    Did you look for a chatserver.jar file?

  11. #11
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Need help to compile java files to class

    Yes i have created empty file BuildDoit.mnf nothing changes to that file still at 0KB, and the chatserver.jar does not appear at all

  12. #12
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Need help to compile java files to class

    Set Path=C:\glassfish3\jdk7\bin
    jar -cmf BuildDoit.mnf chatserver.jar chatserver/META-INF/Manifest.txt chatserver/gui/*.class chatserver/logging/*.class chatserver/main/*.class chatserver/netio/*.class chatserver/objects/*.class chatserver/roles/*.class chatserver/sql/*.class chatserver/tools/*.class
    pause

    if i do this it works, but like said it only creates 50% of the jar file dont get it.

  13. #13
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: Need help to compile java files to class

    If there were no error messages, then there should have been a jar file created. Did you look at the root of the drive?

    Why are you using an empty manifest file: BuildDoit.mnf? What is in the file: Manifest.txt ?

  14. #14
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Re: Need help to compile java files to class

    Quote Originally Posted by Norm View Post
    If there were no error messages, then there should have been a jar file created. Did you look at the root of the drive?

    Why are you using an empty manifest file: BuildDoit.mnf? What is in the file: Manifest.txt ?
    I have fixed it:
    Now the only problem i have is my passwords are not being stored into the database correctly:

    for example:
    If a user is logged in to the chat and uses the command:
    /register nickname password e-mail
    It register his nickname, with the password, and email without problems
    but once i reconnnect it ask me to input password, i do this and it says its wrong?

    here is my table:
    Java Code:
    CREATE TABLE IF NOT EXISTS `user` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` text NOT NULL,
      `password` text NOT NULL,
      `roleid` int(11) NOT NULL,
      `roleby` text NOT NULL,
      `age` text NOT NULL,
      `gender` text NOT NULL,
      `city` text NOT NULL,
      `homepage` text NOT NULL,
      `extra` text NOT NULL,
      `email` text NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=Xeround DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
    
    --
    -- Dumping data for table `user`
    --
    
    INSERT INTO `user` (`id`, `name`, `password`, `roleid`, `roleby`, `age`, `gender`, `city`, `homepage`, `extra`, `email`) VALUES
    (1, 'admin', 'password', 2, 'Admin', '23', 'Man', 'Rotterdam', 'http://www.myble.nl', ':)', 'n.merciano@gmail.com'),
    (2, 'dimos', 'pass', 2, 'dimos', '', '', '', '', '', 'email'),
    (3, 'lukas', 'test', 2, 'Lukas', '', '', '', '', '', 'test@test.nl');
    what am i doing wrong?

Similar Threads

  1. Compile a set of java files for a sudoku program
    By kanishk.dudeja in forum New To Java
    Replies: 3
    Last Post: 06-16-2011, 04:52 PM
  2. Replies: 0
    Last Post: 11-26-2010, 09:34 PM
  3. How to Compile JavaScript source into Java class files
    By tosreejith in forum New To Java
    Replies: 0
    Last Post: 04-06-2009, 03:12 PM
  4. Replies: 6
    Last Post: 02-06-2009, 08:05 PM
  5. [SOLVED] Java Class won't compile
    By kaizen in forum Java Applets
    Replies: 9
    Last Post: 10-18-2008, 06:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •